@geotab/zenith 3.10.0-beta.7 → 3.11.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 (317) hide show
  1. package/README.md +33 -0
  2. package/dist/calendar/calendar.js +7 -4
  3. package/dist/card/components/title.js +4 -1
  4. package/dist/card/components/titleLink.js +5 -2
  5. package/dist/chart/barChart/getDefaultOptions.d.ts +2 -1
  6. package/dist/chart/barChart/getDefaultOptions.js +5 -2
  7. package/dist/chart/barChart.js +6 -4
  8. package/dist/chart/lineChart/getDefaultOptions.d.ts +2 -1
  9. package/dist/chart/lineChart/getDefaultOptions.js +5 -2
  10. package/dist/chart/lineChart.js +4 -2
  11. package/dist/checkboxListWithAction/checkboxListWithAction.js +4 -1
  12. package/dist/commonHelpers/arrowNavigation/components/arrowButton/arrowButton.js +4 -1
  13. package/dist/commonStyles/pillStyles/pillContent.less +13 -14
  14. package/dist/commonStyles/pillStyles/pillStyles.less +4 -5
  15. package/dist/commonStyles/pillStyles/pillTextContent.less +2 -2
  16. package/dist/commonStyles/typography/typography.less +579 -19
  17. package/dist/controlledPopup/controlledPopup.d.ts +1 -0
  18. package/dist/controlledPopup/controlledPopup.js +3 -1
  19. package/dist/dataGrid/cell/cell.d.ts +2 -1
  20. package/dist/dataGrid/cell/cell.js +2 -2
  21. package/dist/dataGrid/dataGrid.js +7 -4
  22. package/dist/dataGrid/listColumn.d.ts +2 -0
  23. package/dist/dataGrid/row/row.d.ts +2 -1
  24. package/dist/dataGrid/row/row.js +13 -9
  25. package/dist/dataGrid/withFlexibleColumns/components/columnSettingsList.js +2 -1
  26. package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +4 -0
  27. package/dist/dateRangeInner/dateRangeInner.js +5 -2
  28. package/dist/dateRangeRaw/dateRangeRaw.js +5 -2
  29. package/dist/dateRangeRaw/utils/parseLabel.js +1 -1
  30. package/dist/dropdownRaw/dropdownRaw.js +12 -6
  31. package/dist/fileUpload/components/dropZoneContent.js +100 -100
  32. package/dist/fileUpload/fileUpload.js +100 -100
  33. package/dist/filters/components/filtersSearchList.js +4 -1
  34. package/dist/filtersBar/filtersContainer/filtersContainer.js +62 -61
  35. package/dist/formStepperButtons/formStepperButtons.js +4 -1
  36. package/dist/groupsFilterRaw/groupsFilterAdjustmentState.js +4 -1
  37. package/dist/groupsFilterRaw/groupsFilterInitialState.js +4 -1
  38. package/dist/header/headerBack.js +4 -1
  39. package/dist/icons/iconAlignLeft.js +1 -3
  40. package/dist/icons/iconAlignmentLeft.js +1 -3
  41. package/dist/icons/iconAlignmentRight.js +1 -3
  42. package/dist/icons/iconArrowBottomLeft.js +1 -3
  43. package/dist/icons/iconArrowBottomRight.js +1 -3
  44. package/dist/icons/iconArrowLeftPath.js +1 -3
  45. package/dist/icons/iconArrowRight.js +1 -3
  46. package/dist/icons/iconArrowRightCircle.js +1 -3
  47. package/dist/icons/iconArrowRightPath.js +1 -3
  48. package/dist/icons/iconArrowTopLeft.js +1 -3
  49. package/dist/icons/iconArrowTopRight.js +1 -3
  50. package/dist/icons/iconChevronDoubleRight.js +1 -3
  51. package/dist/icons/iconChevronRight.js +1 -3
  52. package/dist/icons/iconChevronRightSmall.js +1 -3
  53. package/dist/icons/iconCornerDownLeft.js +1 -3
  54. package/dist/icons/iconCornerDownRight.js +1 -3
  55. package/dist/icons/iconCornerLeftDown.js +1 -3
  56. package/dist/icons/iconCornerLeftUp.js +1 -3
  57. package/dist/icons/iconCornerRightDown.js +1 -3
  58. package/dist/icons/iconCornerRightUp.js +1 -3
  59. package/dist/icons/iconCornerUpLeft.js +1 -3
  60. package/dist/icons/iconCornerUpRight.js +1 -3
  61. package/dist/index.css +3257 -2925
  62. package/dist/index.d.ts +1 -0
  63. package/dist/index.js +3 -1
  64. package/dist/lineChartMini/lineChartMini.js +15 -3
  65. package/dist/list/itemData/itemDataInternal.js +4 -1
  66. package/dist/list/list.d.ts +1 -0
  67. package/dist/list/list.js +2 -2
  68. package/dist/list/listItem/listItem.d.ts +1 -3
  69. package/dist/list/listItem/listItem.js +6 -5
  70. package/dist/menu/components/controlledMenuList/controlledMenuList.d.ts +27 -0
  71. package/dist/menu/components/controlledMenuList/controlledMenuList.js +126 -0
  72. package/dist/menu/components/createControlledMenuList.d.ts +37 -0
  73. package/dist/menu/components/createControlledMenuList.js +55 -0
  74. package/dist/menu/components/createMenuItem.d.ts +67 -0
  75. package/dist/menu/components/createMenuItem.js +97 -0
  76. package/dist/menu/components/menuButton.js +12 -3
  77. package/dist/menu/components/menuItem.d.ts +1 -2
  78. package/dist/menu/components/menuItem.js +20 -74
  79. package/dist/menu/contexts/usePathContext.d.ts +2 -0
  80. package/dist/menu/contexts/usePathContext.js +9 -0
  81. package/dist/menu/controlledMenu.js +8 -175
  82. package/dist/menu/utils/buildMenuContent.d.ts +2 -0
  83. package/dist/menu/utils/buildMenuContent.js +38 -0
  84. package/dist/menu/utils/findContent.d.ts +2 -2
  85. package/dist/menu/utils/findContent.js +4 -3
  86. package/dist/menu/utils/getItemLabel.d.ts +2 -0
  87. package/dist/menu/utils/getItemLabel.js +8 -0
  88. package/dist/menu/utils/getSafeRel.d.ts +1 -0
  89. package/dist/menu/utils/getSafeRel.js +14 -0
  90. package/dist/menu/utils/isMenuItem.d.ts +2 -0
  91. package/dist/menu/utils/isMenuItem.js +13 -0
  92. package/dist/menu/utils/isSafeHref.d.ts +1 -0
  93. package/dist/menu/utils/isSafeHref.js +10 -0
  94. package/dist/menu/utils/normalizeSeparators.d.ts +2 -0
  95. package/dist/menu/utils/normalizeSeparators.js +23 -0
  96. package/dist/menu/utils/resolveKeys.d.ts +12 -0
  97. package/dist/menu/utils/resolveKeys.js +22 -0
  98. package/dist/menu/utils/useLastValidSheet.d.ts +7 -0
  99. package/dist/menu/utils/useLastValidSheet.js +30 -0
  100. package/dist/menu/utils/useMenuItemCore.d.ts +31 -0
  101. package/dist/menu/utils/useMenuItemCore.js +54 -0
  102. package/dist/menu/utils/useMenuItemKeyboardNav.d.ts +2 -0
  103. package/dist/menu/utils/useMenuItemKeyboardNav.js +15 -0
  104. package/dist/menu/utils/useMenuListKeyboardNav.d.ts +12 -0
  105. package/dist/menu/utils/useMenuListKeyboardNav.js +77 -0
  106. package/dist/menu/utils/useMenuPath.d.ts +6 -0
  107. package/dist/menu/utils/useMenuPath.js +35 -0
  108. package/dist/nav/navItem/navItem.js +10 -5
  109. package/dist/nav/navSection/navSection.js +7 -5
  110. package/dist/pagination/paginationArrow.js +10 -3
  111. package/dist/radioGroupRaw/radioGroupRaw.js +2 -1
  112. package/dist/rangeRaw/rangeRaw.js +0 -1
  113. package/dist/selectList/selectList.helpers.d.ts +1 -1
  114. package/dist/selectList/selectList.helpers.js +29 -4
  115. package/dist/selectList/selectList.js +3 -1
  116. package/dist/selectList/selectList.reducer.js +1 -2
  117. package/dist/selectList/selectListItem.js +4 -1
  118. package/dist/sortControl/sortControl.js +59 -4
  119. package/dist/table/children/useTableChildren.d.ts +1 -1
  120. package/dist/table/children/useTableChildren.js +3 -3
  121. package/dist/table/flexible/columnsList.js +4 -2
  122. package/dist/table/selectable/useSelectableRows.d.ts +8 -0
  123. package/dist/table/selectable/useSelectableRows.js +14 -6
  124. package/dist/table/table.js +1 -7
  125. package/dist/tabs/tabs.js +60 -58
  126. package/dist/tabs/tabsTestHelper.js +2 -2
  127. package/dist/timePickerRaw/timePickerRaw.js +1 -1
  128. package/dist/toggleButtonRaw/toggleButtonRaw.js +5 -2
  129. package/dist/utils/localization/translations/ar.json +3 -1
  130. package/dist/utils/localization/translations/cs.json +9 -5
  131. package/dist/utils/localization/translations/da-DK.json +9 -5
  132. package/dist/utils/localization/translations/de.json +9 -5
  133. package/dist/utils/localization/translations/en.json +5 -1
  134. package/dist/utils/localization/translations/es.json +9 -5
  135. package/dist/utils/localization/translations/fi-FI.json +9 -5
  136. package/dist/utils/localization/translations/fr-FR.json +9 -5
  137. package/dist/utils/localization/translations/fr.json +9 -5
  138. package/dist/utils/localization/translations/hu-HU.json +9 -5
  139. package/dist/utils/localization/translations/id.json +9 -5
  140. package/dist/utils/localization/translations/it.json +9 -5
  141. package/dist/utils/localization/translations/ja.json +9 -5
  142. package/dist/utils/localization/translations/ko-KR.json +9 -5
  143. package/dist/utils/localization/translations/ms.json +9 -5
  144. package/dist/utils/localization/translations/nb-NO.json +9 -5
  145. package/dist/utils/localization/translations/nl.json +9 -5
  146. package/dist/utils/localization/translations/pl.json +9 -5
  147. package/dist/utils/localization/translations/pt-BR.json +9 -5
  148. package/dist/utils/localization/translations/pt-PT.json +9 -5
  149. package/dist/utils/localization/translations/ro-RO.json +9 -5
  150. package/dist/utils/localization/translations/sk-SK.json +9 -5
  151. package/dist/utils/localization/translations/sv.json +9 -5
  152. package/dist/utils/localization/translations/th.json +9 -5
  153. package/dist/utils/localization/translations/tr.json +9 -5
  154. package/dist/utils/localization/translations/zh-Hans.json +9 -5
  155. package/dist/utils/localization/translations/zh-TW.json +9 -5
  156. package/dist/utils/localization/useDirectionalIcon.d.ts +3 -0
  157. package/dist/utils/localization/useDirectionalIcon.js +9 -0
  158. package/dist/utils/positioningUtils/alignments.d.ts +2 -2
  159. package/dist/utils/positioningUtils/alignments.js +2 -2
  160. package/dist/utils/positioningUtils/calculatePosition.js +4 -6
  161. package/esm/calendar/calendar.js +7 -4
  162. package/esm/card/components/title.js +4 -1
  163. package/esm/card/components/titleLink.js +5 -2
  164. package/esm/chart/barChart/getDefaultOptions.d.ts +2 -1
  165. package/esm/chart/barChart/getDefaultOptions.js +5 -2
  166. package/esm/chart/barChart.js +6 -4
  167. package/esm/chart/lineChart/getDefaultOptions.d.ts +2 -1
  168. package/esm/chart/lineChart/getDefaultOptions.js +5 -2
  169. package/esm/chart/lineChart.js +4 -2
  170. package/esm/checkboxListWithAction/checkboxListWithAction.js +4 -1
  171. package/esm/commonHelpers/arrowNavigation/components/arrowButton/arrowButton.js +4 -1
  172. package/esm/controlledPopup/controlledPopup.d.ts +1 -0
  173. package/esm/controlledPopup/controlledPopup.js +3 -1
  174. package/esm/dataGrid/cell/cell.d.ts +2 -1
  175. package/esm/dataGrid/cell/cell.js +2 -2
  176. package/esm/dataGrid/dataGrid.js +7 -4
  177. package/esm/dataGrid/listColumn.d.ts +2 -0
  178. package/esm/dataGrid/row/row.d.ts +2 -1
  179. package/esm/dataGrid/row/row.js +13 -9
  180. package/esm/dataGrid/withFlexibleColumns/components/columnSettingsList.js +2 -1
  181. package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +4 -0
  182. package/esm/dateRangeInner/dateRangeInner.js +5 -2
  183. package/esm/dateRangeRaw/dateRangeRaw.js +5 -2
  184. package/esm/dateRangeRaw/utils/parseLabel.js +1 -1
  185. package/esm/dropdownRaw/dropdownRaw.js +12 -6
  186. package/esm/fileUpload/components/dropZoneContent.js +100 -100
  187. package/esm/fileUpload/fileUpload.js +100 -100
  188. package/esm/filters/components/filtersSearchList.js +4 -1
  189. package/esm/filtersBar/filtersContainer/filtersContainer.js +62 -61
  190. package/esm/formStepperButtons/formStepperButtons.js +4 -1
  191. package/esm/groupsFilterRaw/groupsFilterAdjustmentState.js +4 -1
  192. package/esm/groupsFilterRaw/groupsFilterInitialState.js +4 -1
  193. package/esm/header/headerBack.js +4 -1
  194. package/esm/icons/iconAlignLeft.js +1 -3
  195. package/esm/icons/iconAlignmentLeft.js +1 -3
  196. package/esm/icons/iconAlignmentRight.js +1 -3
  197. package/esm/icons/iconArrowBottomLeft.js +1 -3
  198. package/esm/icons/iconArrowBottomRight.js +1 -3
  199. package/esm/icons/iconArrowLeftPath.js +1 -3
  200. package/esm/icons/iconArrowRight.js +1 -3
  201. package/esm/icons/iconArrowRightCircle.js +1 -3
  202. package/esm/icons/iconArrowRightPath.js +1 -3
  203. package/esm/icons/iconArrowTopLeft.js +1 -3
  204. package/esm/icons/iconArrowTopRight.js +1 -3
  205. package/esm/icons/iconChevronDoubleRight.js +1 -3
  206. package/esm/icons/iconChevronRight.js +1 -3
  207. package/esm/icons/iconChevronRightSmall.js +1 -3
  208. package/esm/icons/iconCornerDownLeft.js +1 -3
  209. package/esm/icons/iconCornerDownRight.js +1 -3
  210. package/esm/icons/iconCornerLeftDown.js +1 -3
  211. package/esm/icons/iconCornerLeftUp.js +1 -3
  212. package/esm/icons/iconCornerRightDown.js +1 -3
  213. package/esm/icons/iconCornerRightUp.js +1 -3
  214. package/esm/icons/iconCornerUpLeft.js +1 -3
  215. package/esm/icons/iconCornerUpRight.js +1 -3
  216. package/esm/index.d.ts +1 -0
  217. package/esm/index.js +1 -0
  218. package/esm/lineChartMini/lineChartMini.js +15 -3
  219. package/esm/list/itemData/itemDataInternal.js +4 -1
  220. package/esm/list/list.d.ts +1 -0
  221. package/esm/list/list.js +2 -2
  222. package/esm/list/listItem/listItem.d.ts +1 -3
  223. package/esm/list/listItem/listItem.js +6 -5
  224. package/esm/menu/components/controlledMenuList/controlledMenuList.d.ts +27 -0
  225. package/esm/menu/components/controlledMenuList/controlledMenuList.js +123 -0
  226. package/esm/menu/components/createControlledMenuList.d.ts +37 -0
  227. package/esm/menu/components/createControlledMenuList.js +51 -0
  228. package/esm/menu/components/createMenuItem.d.ts +67 -0
  229. package/esm/menu/components/createMenuItem.js +93 -0
  230. package/esm/menu/components/menuButton.js +12 -3
  231. package/esm/menu/components/menuItem.d.ts +1 -2
  232. package/esm/menu/components/menuItem.js +20 -74
  233. package/esm/menu/contexts/usePathContext.d.ts +2 -0
  234. package/esm/menu/contexts/usePathContext.js +5 -0
  235. package/esm/menu/controlledMenu.js +10 -177
  236. package/esm/menu/utils/buildMenuContent.d.ts +2 -0
  237. package/esm/menu/utils/buildMenuContent.js +34 -0
  238. package/esm/menu/utils/findContent.d.ts +2 -2
  239. package/esm/menu/utils/findContent.js +4 -3
  240. package/esm/menu/utils/getItemLabel.d.ts +2 -0
  241. package/esm/menu/utils/getItemLabel.js +4 -0
  242. package/esm/menu/utils/getSafeRel.d.ts +1 -0
  243. package/esm/menu/utils/getSafeRel.js +10 -0
  244. package/esm/menu/utils/isMenuItem.d.ts +2 -0
  245. package/esm/menu/utils/isMenuItem.js +9 -0
  246. package/esm/menu/utils/isSafeHref.d.ts +1 -0
  247. package/esm/menu/utils/isSafeHref.js +6 -0
  248. package/esm/menu/utils/normalizeSeparators.d.ts +2 -0
  249. package/esm/menu/utils/normalizeSeparators.js +19 -0
  250. package/esm/menu/utils/resolveKeys.d.ts +12 -0
  251. package/esm/menu/utils/resolveKeys.js +18 -0
  252. package/esm/menu/utils/useLastValidSheet.d.ts +7 -0
  253. package/esm/menu/utils/useLastValidSheet.js +26 -0
  254. package/esm/menu/utils/useMenuItemCore.d.ts +31 -0
  255. package/esm/menu/utils/useMenuItemCore.js +50 -0
  256. package/esm/menu/utils/useMenuItemKeyboardNav.d.ts +2 -0
  257. package/esm/menu/utils/useMenuItemKeyboardNav.js +11 -0
  258. package/esm/menu/utils/useMenuListKeyboardNav.d.ts +12 -0
  259. package/esm/menu/utils/useMenuListKeyboardNav.js +73 -0
  260. package/esm/menu/utils/useMenuPath.d.ts +6 -0
  261. package/esm/menu/utils/useMenuPath.js +31 -0
  262. package/esm/nav/navItem/navItem.js +10 -5
  263. package/esm/nav/navSection/navSection.js +7 -5
  264. package/esm/pagination/paginationArrow.js +10 -3
  265. package/esm/radioGroupRaw/radioGroupRaw.js +2 -1
  266. package/esm/rangeRaw/rangeRaw.js +0 -1
  267. package/esm/selectList/selectList.helpers.d.ts +1 -1
  268. package/esm/selectList/selectList.helpers.js +29 -4
  269. package/esm/selectList/selectList.js +3 -1
  270. package/esm/selectList/selectList.reducer.js +1 -2
  271. package/esm/selectList/selectListItem.js +4 -1
  272. package/esm/sortControl/sortControl.js +59 -4
  273. package/esm/table/children/useTableChildren.d.ts +1 -1
  274. package/esm/table/children/useTableChildren.js +3 -3
  275. package/esm/table/flexible/columnsList.js +4 -2
  276. package/esm/table/selectable/useSelectableRows.d.ts +8 -0
  277. package/esm/table/selectable/useSelectableRows.js +14 -6
  278. package/esm/table/table.js +1 -7
  279. package/esm/tabs/tabs.js +60 -58
  280. package/esm/tabs/tabsTestHelper.js +2 -2
  281. package/esm/testHelpers/mockAbsoluteAlignment.d.ts +1 -0
  282. package/esm/testHelpers/mockAbsoluteAlignment.js +10 -0
  283. package/esm/timePickerRaw/timePickerRaw.js +1 -1
  284. package/esm/toggleButtonRaw/toggleButtonRaw.js +5 -2
  285. package/esm/utils/localization/translations/ar.json +3 -1
  286. package/esm/utils/localization/translations/cs.json +9 -5
  287. package/esm/utils/localization/translations/da-DK.json +9 -5
  288. package/esm/utils/localization/translations/de.json +9 -5
  289. package/esm/utils/localization/translations/en.json +5 -1
  290. package/esm/utils/localization/translations/es.json +9 -5
  291. package/esm/utils/localization/translations/fi-FI.json +9 -5
  292. package/esm/utils/localization/translations/fr-FR.json +9 -5
  293. package/esm/utils/localization/translations/fr.json +9 -5
  294. package/esm/utils/localization/translations/hu-HU.json +9 -5
  295. package/esm/utils/localization/translations/id.json +9 -5
  296. package/esm/utils/localization/translations/it.json +9 -5
  297. package/esm/utils/localization/translations/ja.json +9 -5
  298. package/esm/utils/localization/translations/ko-KR.json +9 -5
  299. package/esm/utils/localization/translations/ms.json +9 -5
  300. package/esm/utils/localization/translations/nb-NO.json +9 -5
  301. package/esm/utils/localization/translations/nl.json +9 -5
  302. package/esm/utils/localization/translations/pl.json +9 -5
  303. package/esm/utils/localization/translations/pt-BR.json +9 -5
  304. package/esm/utils/localization/translations/pt-PT.json +9 -5
  305. package/esm/utils/localization/translations/ro-RO.json +9 -5
  306. package/esm/utils/localization/translations/sk-SK.json +9 -5
  307. package/esm/utils/localization/translations/sv.json +9 -5
  308. package/esm/utils/localization/translations/th.json +9 -5
  309. package/esm/utils/localization/translations/tr.json +9 -5
  310. package/esm/utils/localization/translations/zh-Hans.json +9 -5
  311. package/esm/utils/localization/translations/zh-TW.json +9 -5
  312. package/esm/utils/localization/useDirectionalIcon.d.ts +3 -0
  313. package/esm/utils/localization/useDirectionalIcon.js +5 -0
  314. package/esm/utils/positioningUtils/alignments.d.ts +2 -2
  315. package/esm/utils/positioningUtils/alignments.js +2 -2
  316. package/esm/utils/positioningUtils/calculatePosition.js +4 -6
  317. package/package.json +123 -122
@@ -0,0 +1,7 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ export declare const useLastValidSheet: (nestedContent: ReactElement[] | null, nestedParent: ReactElement | null, path: string[], children: ReactNode) => {
3
+ sheetContent: ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[];
4
+ sheetParent: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
5
+ sheetPathLength: number;
6
+ sheetParentName: string;
7
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLastValidSheet = void 0;
4
+ const react_1 = require("react");
5
+ const findContent_1 = require("./findContent");
6
+ const getItemLabel_1 = require("./getItemLabel");
7
+ const menuItem_1 = require("../components/menuItem");
8
+ // Preserves the last non-null nested sheet state so the MobileSheet has content
9
+ // to render during its closing animation after `nestedContent` goes null.
10
+ const useLastValidSheet = (nestedContent, nestedParent, path, children) => {
11
+ const lastNestedContentRef = (0, react_1.useRef)([]);
12
+ const lastNestedParentRef = (0, react_1.useRef)(null);
13
+ const lastPathLengthRef = (0, react_1.useRef)(0);
14
+ const lastSheetTitleRef = (0, react_1.useRef)("");
15
+ const rootEl = path.length > 0 ? (0, findContent_1.findContent)(children, menuItem_1.isMenuItem, path[0]) : null;
16
+ const currentSheetTitle = rootEl ? (0, getItemLabel_1.getItemLabel)(rootEl) : "";
17
+ if (nestedContent !== null) {
18
+ lastNestedContentRef.current = nestedContent;
19
+ lastNestedParentRef.current = nestedParent;
20
+ lastPathLengthRef.current = path.length;
21
+ lastSheetTitleRef.current = currentSheetTitle;
22
+ }
23
+ return {
24
+ sheetContent: nestedContent !== null ? nestedContent : lastNestedContentRef.current,
25
+ sheetParent: nestedContent !== null ? nestedParent : lastNestedParentRef.current,
26
+ sheetPathLength: nestedContent !== null ? path.length : lastPathLengthRef.current,
27
+ sheetParentName: nestedContent !== null ? currentSheetTitle : lastSheetTitleRef.current
28
+ };
29
+ };
30
+ exports.useLastValidSheet = useLastValidSheet;
@@ -0,0 +1,31 @@
1
+ import { ReactNode } from "react";
2
+ import { TAlignment } from "../../absolute/absolute";
3
+ export interface IUseMenuItemCoreParams {
4
+ id: string;
5
+ children?: ReactNode;
6
+ className?: string;
7
+ alignment?: TAlignment;
8
+ isMobile?: boolean;
9
+ setIsOpen?: (v: boolean) => void;
10
+ onClick?: (id: string, e: React.MouseEvent) => void;
11
+ onOpenChange?: (isOpen: boolean) => void;
12
+ }
13
+ /**
14
+ * Core menu item logic shared between MenuItem and createMenuItem.
15
+ * Consolidates context access, state computation, and callback memoization.
16
+ */
17
+ export declare const useMenuItemCore: ({ id, children, className, alignment, isMobile, setIsOpen, onClick, onOpenChange }: IUseMenuItemCoreParams) => {
18
+ ref: import("react").RefObject<HTMLButtonElement | null>;
19
+ isOpen: boolean;
20
+ hasChildren: boolean;
21
+ content: ReactNode[];
22
+ openedViaKeyboard: boolean;
23
+ contentAlignment: TAlignment;
24
+ path: string[];
25
+ onOpenBranch: (id: string) => void;
26
+ closeBranch: () => void;
27
+ navigatedViaKeyboardRef: import("react").RefObject<boolean> | undefined;
28
+ handleDesktopActionClick: (e: React.MouseEvent) => void;
29
+ handleTriggerClick: () => void;
30
+ handleOpenChange: () => void;
31
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMenuItemCore = void 0;
4
+ const react_1 = require("react");
5
+ const pathContext_1 = require("../contexts/pathContext");
6
+ const headerContext_1 = require("../../header/headerContext");
7
+ const buildMenuContent_1 = require("./buildMenuContent");
8
+ const useMenuItemKeyboardNav_1 = require("./useMenuItemKeyboardNav");
9
+ const directionContext_1 = require("../../utils/localization/directionContext");
10
+ /**
11
+ * Core menu item logic shared between MenuItem and createMenuItem.
12
+ * Consolidates context access, state computation, and callback memoization.
13
+ */
14
+ const useMenuItemCore = ({ id, children, className, alignment, isMobile = false, setIsOpen, onClick, onOpenChange }) => {
15
+ const alignmentContext = (0, react_1.useContext)(headerContext_1.MenuAlignmentContext);
16
+ const direction = (0, react_1.useContext)(directionContext_1.directionContext);
17
+ const defaultAlignment = direction === "rtl" ? "left-top" : "right-top";
18
+ const contentAlignment = alignment || alignmentContext.alignment || defaultAlignment;
19
+ const { path, onOpenBranch, closeBranch, navigatedViaKeyboardRef } = (0, react_1.useContext)(pathContext_1.PathContext);
20
+ const ref = (0, react_1.useRef)(null);
21
+ const content = (0, react_1.useMemo)(() => (0, buildMenuContent_1.buildMenuContent)(children, isMobile, setIsOpen, className), [children, isMobile, setIsOpen, className]);
22
+ const isOpen = (0, react_1.useMemo)(() => path.includes(id), [path, id]);
23
+ const hasChildren = content.length > 0;
24
+ const openedViaKeyboard = (0, useMenuItemKeyboardNav_1.useMenuItemKeyboardNav)(isOpen, navigatedViaKeyboardRef);
25
+ const handleDesktopActionClick = (0, react_1.useCallback)((e) => {
26
+ setIsOpen === null || setIsOpen === void 0 ? void 0 : setIsOpen(false);
27
+ onClick === null || onClick === void 0 ? void 0 : onClick(id, e);
28
+ }, [setIsOpen, onClick, id]);
29
+ const handleTriggerClick = (0, react_1.useCallback)(() => {
30
+ onOpenBranch(id);
31
+ }, [id, onOpenBranch]);
32
+ const handleOpenChange = (0, react_1.useCallback)(() => {
33
+ closeBranch();
34
+ }, [closeBranch]);
35
+ (0, react_1.useEffect)(() => {
36
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
37
+ }, [isOpen, onOpenChange]);
38
+ return {
39
+ ref,
40
+ isOpen,
41
+ hasChildren,
42
+ content,
43
+ openedViaKeyboard,
44
+ contentAlignment,
45
+ path,
46
+ onOpenBranch,
47
+ closeBranch,
48
+ navigatedViaKeyboardRef,
49
+ handleDesktopActionClick,
50
+ handleTriggerClick,
51
+ handleOpenChange
52
+ };
53
+ };
54
+ exports.useMenuItemCore = useMenuItemCore;
@@ -0,0 +1,2 @@
1
+ import { RefObject } from "react";
2
+ export declare function useMenuItemKeyboardNav(isOpen: boolean, navigatedViaKeyboardRef: RefObject<boolean> | undefined): boolean;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMenuItemKeyboardNav = void 0;
4
+ const react_1 = require("react");
5
+ function useMenuItemKeyboardNav(isOpen, navigatedViaKeyboardRef) {
6
+ const wasOpenRef = (0, react_1.useRef)(false);
7
+ const localOpenedViaKeyboardRef = (0, react_1.useRef)(false);
8
+ if (isOpen && !wasOpenRef.current && navigatedViaKeyboardRef) {
9
+ localOpenedViaKeyboardRef.current = navigatedViaKeyboardRef.current;
10
+ navigatedViaKeyboardRef.current = false;
11
+ }
12
+ wasOpenRef.current = isOpen;
13
+ return localOpenedViaKeyboardRef.current;
14
+ }
15
+ exports.useMenuItemKeyboardNav = useMenuItemKeyboardNav;
@@ -0,0 +1,12 @@
1
+ import { MutableRefObject } from "react";
2
+ export interface IKeyMap {
3
+ keyNext: string;
4
+ keyPrev: string;
5
+ keyOpenNested: string;
6
+ keyBack: string;
7
+ }
8
+ export declare const useMenuListKeyboardNav: (keyboardActiveRef: MutableRefObject<boolean>, navigatedViaKeyboardRef: MutableRefObject<boolean>, isHorizontal: boolean) => {
9
+ onKeyDown: (e: React.KeyboardEvent) => void;
10
+ onKeyDownVertical: (e: React.KeyboardEvent) => void;
11
+ onMouseDown: () => void;
12
+ };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMenuListKeyboardNav = void 0;
4
+ const react_1 = require("react");
5
+ const findFirstFocusable_1 = require("./findFirstFocusable");
6
+ const findLastFocusable_1 = require("./findLastFocusable");
7
+ const findNextFocusable_1 = require("./findNextFocusable");
8
+ const findPrevFocusable_1 = require("./findPrevFocusable");
9
+ const isButton_1 = require("./isButton");
10
+ const isLink_1 = require("./isLink");
11
+ const resolveKeys_1 = require("./resolveKeys");
12
+ const useMenuListKeyboardNav = (keyboardActiveRef, navigatedViaKeyboardRef, isHorizontal) => {
13
+ const handleNavigation = (0, react_1.useCallback)(
14
+ // eslint-disable-next-line complexity
15
+ (e, keyMap) => {
16
+ var _a, _b, _c, _d, _e, _f;
17
+ keyboardActiveRef.current = true;
18
+ const target = e.target;
19
+ const currentTarget = e.currentTarget;
20
+ if (!(0, isButton_1.isButton)(target) && !(0, isLink_1.isLink)(target)) {
21
+ if (target === currentTarget) {
22
+ const menuList = currentTarget.querySelector("ul");
23
+ if (menuList) {
24
+ if (e.key === keyMap.keyNext || e.key === "Home") {
25
+ e.preventDefault();
26
+ (_a = (0, findFirstFocusable_1.findFirstFocusable)(menuList)) === null || _a === void 0 ? void 0 : _a.focus();
27
+ }
28
+ else if (e.key === keyMap.keyPrev || e.key === "End") {
29
+ e.preventDefault();
30
+ (_b = (0, findLastFocusable_1.findLastFocusable)(menuList)) === null || _b === void 0 ? void 0 : _b.focus();
31
+ }
32
+ }
33
+ }
34
+ return;
35
+ }
36
+ const isItemWithChildren = (e.key === keyMap.keyOpenNested || e.key === "Enter" || e.key === " ") &&
37
+ target.classList.contains("zen-menu-button__action--has-children");
38
+ const isBackButton = (e.key === keyMap.keyBack || e.key === "Enter" || e.key === " ") && target.dataset.id === "root";
39
+ if (e.key === keyMap.keyNext) {
40
+ e.preventDefault();
41
+ (_c = (0, findNextFocusable_1.findNextFocusable)(target)) === null || _c === void 0 ? void 0 : _c.focus();
42
+ return;
43
+ }
44
+ if (e.key === keyMap.keyPrev) {
45
+ e.preventDefault();
46
+ (_d = (0, findPrevFocusable_1.findPrevFocusable)(target)) === null || _d === void 0 ? void 0 : _d.focus();
47
+ return;
48
+ }
49
+ if (e.key === "Home") {
50
+ e.preventDefault();
51
+ (_e = (0, findFirstFocusable_1.findFirstFocusable)(target)) === null || _e === void 0 ? void 0 : _e.focus();
52
+ return;
53
+ }
54
+ if (e.key === "End") {
55
+ e.preventDefault();
56
+ (_f = (0, findLastFocusable_1.findLastFocusable)(target)) === null || _f === void 0 ? void 0 : _f.focus();
57
+ return;
58
+ }
59
+ if ((0, isButton_1.isButton)(target) && (isItemWithChildren || isBackButton)) {
60
+ e.preventDefault();
61
+ navigatedViaKeyboardRef.current = true;
62
+ target.click();
63
+ }
64
+ }, [keyboardActiveRef, navigatedViaKeyboardRef]);
65
+ const onKeyDown = (0, react_1.useCallback)((e) => {
66
+ handleNavigation(e, (0, resolveKeys_1.resolveKeys)(e.target, isHorizontal));
67
+ }, [isHorizontal, handleNavigation]);
68
+ const onKeyDownVertical = (0, react_1.useCallback)((e) => {
69
+ handleNavigation(e, resolveKeys_1.verticalKeys);
70
+ }, [handleNavigation]);
71
+ const onMouseDown = (0, react_1.useCallback)(() => {
72
+ keyboardActiveRef.current = false;
73
+ // eslint-disable-next-line react-hooks/exhaustive-deps
74
+ }, []);
75
+ return { onKeyDown, onKeyDownVertical, onMouseDown };
76
+ };
77
+ exports.useMenuListKeyboardNav = useMenuListKeyboardNav;
@@ -0,0 +1,6 @@
1
+ export declare const useMenuPath: (isOpen?: boolean) => {
2
+ path: string[];
3
+ onOpenBranch: (branchId?: string) => void;
4
+ closeBranch: () => void;
5
+ closeAll: () => void;
6
+ };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMenuPath = void 0;
4
+ const react_1 = require("react");
5
+ const useMenuPath = (isOpen) => {
6
+ const [path, setPath] = (0, react_1.useState)([]);
7
+ (0, react_1.useEffect)(() => {
8
+ if (isOpen === false) {
9
+ setPath(v => (v.length ? [] : v));
10
+ }
11
+ }, [isOpen]);
12
+ const onOpenBranch = (0, react_1.useCallback)((branchId) => {
13
+ if (!branchId) {
14
+ return;
15
+ }
16
+ setPath(v => {
17
+ if (!v.includes(branchId)) {
18
+ return [...v, branchId];
19
+ }
20
+ const newPath = [...v];
21
+ newPath.pop();
22
+ return newPath;
23
+ });
24
+ }, []);
25
+ const closeBranch = (0, react_1.useCallback)(() => {
26
+ setPath(v => {
27
+ const newPath = [...v];
28
+ newPath.pop();
29
+ return newPath;
30
+ });
31
+ }, []);
32
+ const closeAll = (0, react_1.useCallback)(() => setPath([]), []);
33
+ return { path, onOpenBranch, closeBranch, closeAll };
34
+ };
35
+ exports.useMenuPath = useMenuPath;
@@ -17,7 +17,9 @@ const classNames_1 = require("../../commonHelpers/classNames/classNames");
17
17
  const react_1 = require("react");
18
18
  const iconBeta_1 = require("../../icons/iconBeta");
19
19
  const iconChevronRight_1 = require("../../icons/iconChevronRight");
20
+ const iconChevronLeft_1 = require("../../icons/iconChevronLeft");
20
21
  const iconOpen2_1 = require("../../icons/iconOpen2");
22
+ const useDirectionalIcon_1 = require("../../utils/localization/useDirectionalIcon");
21
23
  const tooltip_1 = require("../../tooltip/tooltip");
22
24
  const controlledMenu_1 = require("../../menu/controlledMenu");
23
25
  const nav_context_1 = require("../context/nav.context");
@@ -29,11 +31,12 @@ const defaultTooltipAlignment = "right";
29
31
  const isLinkNavItem = (item) => !!item.link;
30
32
  const NavItemContent = ({ primaryIcon, secondaryIcon, isBeta, counter, collapsed, hasSubmenu, iconClass, level = 1, children }) => {
31
33
  const primaryIconRef = (0, react_1.useRef)(null);
34
+ const ChevronIcon = (0, useDirectionalIcon_1.useDirectionalIcon)(iconChevronRight_1.IconChevronRight, iconChevronLeft_1.IconChevronLeft);
32
35
  const PrimaryIconComponent = typeof primaryIcon === "function" ? primaryIcon : null;
33
36
  const SecondaryIconComponent = secondaryIcon;
34
37
  const iconSize = level > 1 ? SUBMENU_ICON_SIZE : ICON_SIZE;
35
38
  const primaryIconComponent = primaryIcon ? ((0, jsx_runtime_1.jsx)("span", { ref: primaryIconRef, className: (0, classNames_1.classNames)(["zen-nav-item__icon", counter ? "zen-nav-item__icon--with-counter" : "", iconClass || ""]), children: PrimaryIconComponent ? (0, jsx_runtime_1.jsx)(PrimaryIconComponent, { size: iconSize }) : primaryIcon })) : null;
36
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "zen-nav-item__content-left", children: [isBeta && !collapsed ? ((0, jsx_runtime_1.jsx)("span", { className: "zen-nav-item__beta", children: (0, jsx_runtime_1.jsx)(iconBeta_1.IconBeta, { size: "big" }) })) : null, primaryIconComponent, SecondaryIconComponent && !collapsed ? ((0, jsx_runtime_1.jsx)("span", { className: "zen-nav-item__icon", children: (0, jsx_runtime_1.jsx)(SecondaryIconComponent, { size: iconSize }) })) : null, !collapsed ? (0, jsx_runtime_1.jsx)("span", { className: "zen-nav-item__title", children: children }) : null] }), !collapsed && (counter || hasSubmenu) ? ((0, jsx_runtime_1.jsxs)("div", { className: "zen-nav-item__content-right", children: [counter ? (0, jsx_runtime_1.jsx)("div", { className: "zen-nav-item__counter", children: counter }) : null, hasSubmenu ? (0, jsx_runtime_1.jsx)(iconChevronRight_1.IconChevronRight, { className: "zen-nav-item__title-icon", size: iconSize }) : null] })) : null] }));
39
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "zen-nav-item__content-left", children: [isBeta && !collapsed ? ((0, jsx_runtime_1.jsx)("span", { className: "zen-nav-item__beta", children: (0, jsx_runtime_1.jsx)(iconBeta_1.IconBeta, { size: "big" }) })) : null, primaryIconComponent, SecondaryIconComponent && !collapsed ? ((0, jsx_runtime_1.jsx)("span", { className: "zen-nav-item__icon", children: (0, jsx_runtime_1.jsx)(SecondaryIconComponent, { size: iconSize }) })) : null, !collapsed ? (0, jsx_runtime_1.jsx)("span", { className: "zen-nav-item__title", children: children }) : null] }), !collapsed && (counter || hasSubmenu) ? ((0, jsx_runtime_1.jsxs)("div", { className: "zen-nav-item__content-right", children: [counter ? (0, jsx_runtime_1.jsx)("div", { className: "zen-nav-item__counter", children: counter }) : null, hasSubmenu ? (0, jsx_runtime_1.jsx)(ChevronIcon, { className: "zen-nav-item__title-icon", size: iconSize }) : null] })) : null] }));
37
40
  };
38
41
  const NavItemAction = ({ actionIcon, actionIconTitle = "", onActionIconClick, collapsed, isMenuItem, level = 1 }) => {
39
42
  const ActionIconComponent = actionIcon;
@@ -94,17 +97,19 @@ const ButtonNavItem = (_a) => {
94
97
  }
95
98
  };
96
99
  const handleKeyPress = evt => {
97
- if (evt.key !== "ArrowRight") {
100
+ if (hasNestedItems && (evt.key === "Enter" || evt.key === " ")) {
101
+ evt.preventDefault();
102
+ setMenuOpen(true);
98
103
  return;
99
104
  }
100
- if (hasNestedItems) {
101
- setMenuOpen(prevOpen => !prevOpen);
105
+ if (hasNestedItems && evt.key === "ArrowRight") {
106
+ setMenuOpen(true);
102
107
  }
103
108
  };
104
109
  const isMobile = (0, useMobile_1.useMobile)();
105
110
  const isActive = active || (hasNestedItems && menuOpen);
106
111
  const triggerId = (0, react_1.useId)();
107
- const buttonElement = ((0, jsx_runtime_1.jsx)("button", { id: triggerId, ref: triggerRef, "aria-label": title, title: title, tabIndex: tabIndex, role: isMenuItem ? "menuitem" : undefined, className: "zen-nav-item__main", onClick: handleClick, onKeyDown: handleKeyPress, children: (0, jsx_runtime_1.jsx)(NavItemContent, Object.assign({ title: title, collapsed: collapsed, hasSubmenu: hasNestedItems, level: currentLevel }, rest, { children: (0, jsx_runtime_1.jsx)("span", { className: "zen-nav-item__title-text", children: title }) })) }));
112
+ const buttonElement = ((0, jsx_runtime_1.jsx)("button", { id: triggerId, ref: triggerRef, "aria-label": title, title: title, tabIndex: tabIndex, role: isMenuItem ? "menuitem" : undefined, "aria-haspopup": hasNestedItems ? "menu" : undefined, "aria-expanded": hasNestedItems ? menuOpen : undefined, className: "zen-nav-item__main", onClick: handleClick, onKeyDown: handleKeyPress, children: (0, jsx_runtime_1.jsx)(NavItemContent, Object.assign({ title: title, collapsed: collapsed, hasSubmenu: hasNestedItems, level: currentLevel }, rest, { children: (0, jsx_runtime_1.jsx)("span", { className: "zen-nav-item__title-text", children: title }) })) }));
108
113
  const trigger = collapsed ? ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { trigger: buttonElement, alignment: tooltipAlignment, children: title })) : (buttonElement);
109
114
  if (hasNestedItems) {
110
115
  // Process children to add appropriate level classes while allowing unlimited nesting
@@ -6,6 +6,7 @@ const classNames_1 = require("../../commonHelpers/classNames/classNames");
6
6
  const react_1 = require("react");
7
7
  const nav_context_1 = require("../context/nav.context");
8
8
  const navItem_1 = require("../navItem/navItem");
9
+ const getNavItemMain = (wrapper) => { var _a; return (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.querySelector(".zen-nav-item__main")) !== null && _a !== void 0 ? _a : wrapper; };
9
10
  /**
10
11
  * @beta This component is not fully ready yet and may change in future releases.
11
12
  */
@@ -26,11 +27,11 @@ const NavSection = ({ children, className }) => {
26
27
  if (!sectionRef.current) {
27
28
  return;
28
29
  }
29
- const navItemElements = sectionRef.current.querySelectorAll(".zen-nav-item");
30
+ const navItemElements = sectionRef.current.querySelectorAll(":scope > .zen-nav-item");
30
31
  childRefs.current = Array.from(navItemElements);
31
32
  }, [children]);
32
33
  const arrowClickHandler = (0, react_1.useCallback)(evt => {
33
- var _a, _b, _c;
34
+ var _a;
34
35
  const key = evt.key;
35
36
  if ((key !== "ArrowDown" && key !== "ArrowUp" && key !== "Home" && key !== "End" && key !== "PageUp" && key !== "PageDown") || // non-handled keys
36
37
  !children || // section is empty
@@ -39,7 +40,7 @@ const NavSection = ({ children, className }) => {
39
40
  return;
40
41
  }
41
42
  evt.preventDefault();
42
- (_a = childRefs.current[focusedIndex.current]) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "-1");
43
+ (_a = getNavItemMain(childRefs.current[focusedIndex.current])) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "-1");
43
44
  if (key === "ArrowDown") {
44
45
  // get next in a loop
45
46
  focusedIndex.current = focusedIndex.current === react_1.Children.count(children) - 1 ? 0 : focusedIndex.current + 1;
@@ -54,8 +55,9 @@ const NavSection = ({ children, className }) => {
54
55
  if (key === "End" || key === "PageDown") {
55
56
  focusedIndex.current = react_1.Children.count(children) - 1;
56
57
  }
57
- (_b = childRefs.current[focusedIndex.current]) === null || _b === void 0 ? void 0 : _b.setAttribute("tabindex", "0");
58
- (_c = childRefs.current[focusedIndex.current]) === null || _c === void 0 ? void 0 : _c.focus();
58
+ const nextMain = getNavItemMain(childRefs.current[focusedIndex.current]);
59
+ nextMain === null || nextMain === void 0 ? void 0 : nextMain.setAttribute("tabindex", "0");
60
+ nextMain === null || nextMain === void 0 ? void 0 : nextMain.focus();
59
61
  }, [children]);
60
62
  const cssClasses = (0, classNames_1.classNames)(["zen-nav-section", className || "", collapsed ? "zen-nav-section--collapsed" : ""]);
61
63
  return ((0, jsx_runtime_1.jsx)("div", { ref: sectionRef, role: "menu", className: cssClasses, onKeyDown: arrowClickHandler, children: focusableChildren }));
@@ -8,14 +8,16 @@ Object.defineProperty(exports, "__esModule", {
8
8
  });
9
9
  exports.TRANSLATIONS = exports.PaginationArrow = void 0;
10
10
  const jsx_runtime_1 = require("react/jsx-runtime");
11
- const classNames_1 = require("../commonHelpers/classNames/classNames");
12
11
  const svgIconSize_1 = require("../svgIcon/svgIconSize");
13
12
  const paginationType_1 = require("./paginationType");
14
13
  const textIconButton_1 = require("../textIconButton/textIconButton");
15
14
  const buttonType_1 = require("../button/buttonType");
16
15
  const useLanguage_1 = require("../utils/localization/useLanguage");
17
16
  const iconChevronRight_1 = require("../icons/iconChevronRight");
17
+ const iconChevronLeft_1 = require("../icons/iconChevronLeft");
18
18
  const iconArrowRight_1 = require("../icons/iconArrowRight");
19
+ const iconArrowLeft_1 = require("../icons/iconArrowLeft");
20
+ const useDirectionalIcon_1 = require("../utils/localization/useDirectionalIcon");
19
21
  injectString("cs", "Previous page", "P\u0159edchoz\xED str\xE1nka");
20
22
  injectString("da-DK", "Previous page", "Forrige side");
21
23
  injectString("de", "Previous page", "Vorherige Seite");
@@ -79,6 +81,11 @@ const PaginationArrow = ({
79
81
  const {
80
82
  translate
81
83
  } = (0, useLanguage_1.useLanguage)();
84
+ const isPrevious = value === "previous";
85
+ const [ltrCompact, rtlCompact] = isPrevious ? [iconChevronLeft_1.IconChevronLeft, iconChevronRight_1.IconChevronRight] : [iconChevronRight_1.IconChevronRight, iconChevronLeft_1.IconChevronLeft];
86
+ const [ltrNormal, rtlNormal] = isPrevious ? [iconArrowLeft_1.IconArrowLeft, iconArrowRight_1.IconArrowRight] : [iconArrowRight_1.IconArrowRight, iconArrowLeft_1.IconArrowLeft];
87
+ const CompactIcon = (0, useDirectionalIcon_1.useDirectionalIcon)(ltrCompact, rtlCompact);
88
+ const NormalIcon = (0, useDirectionalIcon_1.useDirectionalIcon)(ltrNormal, rtlNormal);
82
89
  const previousButtonTitle = translate("Previous page");
83
90
  const nextButtonTitle = translate("Next page");
84
91
  const buttonTitle = value === "next" ? nextButtonTitle : previousButtonTitle;
@@ -90,10 +97,10 @@ const PaginationArrow = ({
90
97
  disabled: disabled,
91
98
  onClick: arrowButtonHandler,
92
99
  type: type === paginationType_1.PaginationType.Compact ? buttonType_1.ButtonType.TertiaryBlack : buttonType_1.ButtonType.Secondary,
93
- icon: type === paginationType_1.PaginationType.Compact ? iconChevronRight_1.IconChevronRight : iconArrowRight_1.IconArrowRight,
100
+ icon: type === paginationType_1.PaginationType.Compact ? CompactIcon : NormalIcon,
94
101
  iconSize: type === paginationType_1.PaginationType.Compact ? svgIconSize_1.SvgIconSize.Big : svgIconSize_1.SvgIconSize.Large,
95
102
  iconPosition: textIconButton_1.ButtonIconPosition.Start,
96
- iconClasses: (0, classNames_1.classNames)(["zen-pagination__arrow-navigation-button-icon", value === "previous" ? "zen-pagination__arrow-navigation-button-icon--rotate" : ""])
103
+ iconClasses: "zen-pagination__arrow-navigation-button-icon"
97
104
  });
98
105
  };
99
106
  exports.PaginationArrow = PaginationArrow;
@@ -89,7 +89,8 @@ const RadioGroupRaw = (props) => {
89
89
  "zen-radio-group__item",
90
90
  wrappedInLabel ? "zen-radio-group__item--no-paddings" : "",
91
91
  type === "interactive" ? "zen-radio--interactive" : "",
92
- size === "small" ? "zen-radio-group__item--small" : ""
92
+ size === "small" ? "zen-radio-group__item--small" : "",
93
+ direction === "horizontal" ? "zen-radio--align-start" : ""
93
94
  ]), key: ind, checked: item.value === value, disabled: disabled ? disabled : item.disabled, name: name, reverse: reverse, fullWidth: fullWidth, value: item.value, onChange: onChangeInner, wrappedInLabel: wrappedInLabel, tabIndex: selectItemOnFocus || disabled || item.disabled ? undefined : ind === focusedIndex ? 0 : -1, ref: selectItemOnFocus ? undefined : ind === focusedIndex ? focusElementRef : undefined, role: itemRole }), item.children) }, `${ind}-li`))) })) }));
94
95
  };
95
96
  exports.RadioGroupRaw = RadioGroupRaw;
@@ -427,7 +427,6 @@ const RangeRaw = props => {
427
427
  className: (0, classNames_1.classNames)(["zen-range-popup zen-shadow-dropdown-default", className ? className : ""]),
428
428
  onOpenChange: handleTriggerClick,
429
429
  useTrapFocusWithTrigger: "on",
430
- alignment: "bottom-left",
431
430
  shouldHoldScroll: true,
432
431
  triggerRef: triggerRef,
433
432
  ariaLabel: translate("Range Filter popup"),
@@ -5,7 +5,7 @@ export declare const getItemIdByIndex: (state: Map<string, CheckboxState>, index
5
5
  export declare const getItemIndexById: (state: Map<string, CheckboxState>, id: string) => number;
6
6
  export declare const updateItemState: (initialState: Map<string, CheckboxState>, multiselect: boolean, updatedId: string, newState: CheckboxState) => [Map<string, CheckboxState>, boolean];
7
7
  export declare const searchItemIndex: (items: ISelectListItem[], searchStr: string) => number;
8
- export declare const getFirstIndex: (items: ISelectListItem[]) => 0 | -1;
8
+ export declare const getFirstIndex: (items: ISelectListItem[]) => number;
9
9
  export declare const getLastIndex: (items: ISelectListItem[]) => number;
10
10
  export declare const getNextIndex: (currIndex: number, items: ISelectListItem[]) => number;
11
11
  export declare const getPrevIndex: (currIndex: number, items: ISelectListItem[]) => number;
@@ -42,22 +42,47 @@ const searchItemIndex = (items, searchStr) => {
42
42
  });
43
43
  };
44
44
  exports.searchItemIndex = searchItemIndex;
45
- const getFirstIndex = (items) => (items.length > 0 ? 0 : -1);
45
+ const getFirstIndex = (items) => items.findIndex(item => !item.disabled);
46
46
  exports.getFirstIndex = getFirstIndex;
47
- const getLastIndex = (items) => (items.length > 0 ? items.length - 1 : -1);
47
+ const getLastIndex = (items) => {
48
+ for (let i = items.length - 1; i >= 0; i--) {
49
+ if (!items[i].disabled) {
50
+ return i;
51
+ }
52
+ }
53
+ return -1;
54
+ };
48
55
  exports.getLastIndex = getLastIndex;
49
56
  const getNextIndex = (currIndex, items) => {
57
+ var _a;
50
58
  if (items.length === 0) {
51
59
  return -1;
52
60
  }
53
- return currIndex + 1 >= items.length ? 0 : currIndex + 1;
61
+ let nextIndex = currIndex + 1 >= items.length ? 0 : currIndex + 1;
62
+ const startIndex = nextIndex;
63
+ while ((_a = items[nextIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
64
+ nextIndex = nextIndex + 1 >= items.length ? 0 : nextIndex + 1;
65
+ if (nextIndex === startIndex) {
66
+ return currIndex;
67
+ }
68
+ }
69
+ return nextIndex;
54
70
  };
55
71
  exports.getNextIndex = getNextIndex;
56
72
  const getPrevIndex = (currIndex, items) => {
73
+ var _a;
57
74
  if (items.length === 0) {
58
75
  return -1;
59
76
  }
60
- return currIndex <= 0 || currIndex >= items.length ? items.length - 1 : currIndex - 1;
77
+ let prevIndex = currIndex <= 0 || currIndex >= items.length ? items.length - 1 : currIndex - 1;
78
+ const startIndex = prevIndex;
79
+ while ((_a = items[prevIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
80
+ prevIndex = prevIndex <= 0 ? items.length - 1 : prevIndex - 1;
81
+ if (prevIndex === startIndex) {
82
+ return currIndex;
83
+ }
84
+ }
85
+ return prevIndex;
61
86
  };
62
87
  exports.getPrevIndex = getPrevIndex;
63
88
  const getFirstActiveIndex = (state, items, multiselect) => {
@@ -51,7 +51,9 @@ const SelectList = (_a) => {
51
51
  if (!multiselect && selectItemOnFocus) {
52
52
  dispatchState({ type: selectList_actionTypes_1.ListAction.FocusFirst, payload: { items } });
53
53
  }
54
- dispatchState({ type: selectList_actionTypes_1.ListAction.Focus, payload: { items, multiselect } });
54
+ if (!multiselect) {
55
+ dispatchState({ type: selectList_actionTypes_1.ListAction.Focus, payload: { items, multiselect } });
56
+ }
55
57
  }, [multiselect, items, selectItemOnFocus]);
56
58
  (0, react_2.useEffect)(() => {
57
59
  onChange && state.isItemsStateChanged && onChange(new Map(state.itemsState));
@@ -120,8 +120,7 @@ const selectListReducer = (state, action) => {
120
120
  newItemsState = updatedState;
121
121
  });
122
122
  const prevActiveItemId = (0, selectList_helpers_1.getItemIdByIndex)(state.itemsState, state.activeIndex);
123
- const newActiveItemIndex = !!prevActiveItemId && (0, selectList_helpers_1.getItemIndexById)(newItemsState, prevActiveItemId);
124
- const activeIndex = newActiveItemIndex ? newActiveItemIndex : -1;
123
+ const activeIndex = prevActiveItemId !== undefined ? (0, selectList_helpers_1.getItemIndexById)(newItemsState, prevActiveItemId) : -1;
125
124
  return Object.assign(Object.assign({}, state), { itemsState: newItemsState, activeIndex, isItemsStateChanged: false });
126
125
  }
127
126
  case selectList_actionTypes_1.ListAction.SetLevel: {
@@ -6,9 +6,12 @@ const checkboxState_1 = require("../checkbox/checkboxState");
6
6
  const checkboxNonInteractive_1 = require("../checkboxNonInteractive/checkboxNonInteractive");
7
7
  const classNames_1 = require("../commonHelpers/classNames/classNames");
8
8
  const iconChevronRight_1 = require("../icons/iconChevronRight");
9
+ const iconChevronLeft_1 = require("../icons/iconChevronLeft");
10
+ const useDirectionalIcon_1 = require("../utils/localization/useDirectionalIcon");
9
11
  const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
10
12
  const SelectListItem = ({ id, disabled = false, state = checkboxState_1.CheckboxState.Off, showCheckbox = false, focused = false, onChange, onClick, multiLevel, className = "", children }) => {
11
13
  const driveClassName = (0, useDriveClassName_1.useDriveClassName)("zen-select-item");
14
+ const ChevronIcon = (0, useDirectionalIcon_1.useDirectionalIcon)(iconChevronRight_1.IconChevronRight, iconChevronLeft_1.IconChevronLeft);
12
15
  const onClickFunc = () => {
13
16
  if (disabled) {
14
17
  return;
@@ -30,6 +33,6 @@ const SelectListItem = ({ id, disabled = false, state = checkboxState_1.Checkbox
30
33
  "zen-select-item__wrapper",
31
34
  "zen-ellipsis",
32
35
  multiLevel ? "zen-select-item__wrapper--with-arrow" : ""
33
- ]), children: [showCheckbox ? ((0, jsx_runtime_1.jsx)(checkboxNonInteractive_1.CheckboxNonInteractive, { className: "zen-select-item__control-view", checked: state === checkboxState_1.CheckboxState.On, indeterminate: state === checkboxState_1.CheckboxState.Indeterminate, disabled: disabled, children: children })) : (children), multiLevel && !showCheckbox ? (0, jsx_runtime_1.jsx)(iconChevronRight_1.IconChevronRight, { size: "large" }) : null] }) }));
36
+ ]), children: [showCheckbox ? ((0, jsx_runtime_1.jsx)(checkboxNonInteractive_1.CheckboxNonInteractive, { className: "zen-select-item__control-view", checked: state === checkboxState_1.CheckboxState.On, indeterminate: state === checkboxState_1.CheckboxState.Indeterminate, disabled: disabled, children: children })) : (children), multiLevel && !showCheckbox ? (0, jsx_runtime_1.jsx)(ChevronIcon, { size: "large" }) : null] }) }));
34
37
  };
35
38
  exports.SelectListItem = SelectListItem;