@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,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,50 @@
1
+ import { useRef, useContext, useMemo, useCallback, useEffect } from "react";
2
+ import { PathContext } from "../contexts/pathContext";
3
+ import { MenuAlignmentContext } from "../../header/headerContext";
4
+ import { buildMenuContent } from "./buildMenuContent";
5
+ import { useMenuItemKeyboardNav } from "./useMenuItemKeyboardNav";
6
+ import { directionContext } from "../../utils/localization/directionContext";
7
+ /**
8
+ * Core menu item logic shared between MenuItem and createMenuItem.
9
+ * Consolidates context access, state computation, and callback memoization.
10
+ */
11
+ export const useMenuItemCore = ({ id, children, className, alignment, isMobile = false, setIsOpen, onClick, onOpenChange }) => {
12
+ const alignmentContext = useContext(MenuAlignmentContext);
13
+ const direction = useContext(directionContext);
14
+ const defaultAlignment = direction === "rtl" ? "left-top" : "right-top";
15
+ const contentAlignment = alignment || alignmentContext.alignment || defaultAlignment;
16
+ const { path, onOpenBranch, closeBranch, navigatedViaKeyboardRef } = useContext(PathContext);
17
+ const ref = useRef(null);
18
+ const content = useMemo(() => buildMenuContent(children, isMobile, setIsOpen, className), [children, isMobile, setIsOpen, className]);
19
+ const isOpen = useMemo(() => path.includes(id), [path, id]);
20
+ const hasChildren = content.length > 0;
21
+ const openedViaKeyboard = useMenuItemKeyboardNav(isOpen, navigatedViaKeyboardRef);
22
+ const handleDesktopActionClick = useCallback((e) => {
23
+ setIsOpen === null || setIsOpen === void 0 ? void 0 : setIsOpen(false);
24
+ onClick === null || onClick === void 0 ? void 0 : onClick(id, e);
25
+ }, [setIsOpen, onClick, id]);
26
+ const handleTriggerClick = useCallback(() => {
27
+ onOpenBranch(id);
28
+ }, [id, onOpenBranch]);
29
+ const handleOpenChange = useCallback(() => {
30
+ closeBranch();
31
+ }, [closeBranch]);
32
+ useEffect(() => {
33
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
34
+ }, [isOpen, onOpenChange]);
35
+ return {
36
+ ref,
37
+ isOpen,
38
+ hasChildren,
39
+ content,
40
+ openedViaKeyboard,
41
+ contentAlignment,
42
+ path,
43
+ onOpenBranch,
44
+ closeBranch,
45
+ navigatedViaKeyboardRef,
46
+ handleDesktopActionClick,
47
+ handleTriggerClick,
48
+ handleOpenChange
49
+ };
50
+ };
@@ -0,0 +1,2 @@
1
+ import { RefObject } from "react";
2
+ export declare function useMenuItemKeyboardNav(isOpen: boolean, navigatedViaKeyboardRef: RefObject<boolean> | undefined): boolean;
@@ -0,0 +1,11 @@
1
+ import { useRef } from "react";
2
+ export function useMenuItemKeyboardNav(isOpen, navigatedViaKeyboardRef) {
3
+ const wasOpenRef = useRef(false);
4
+ const localOpenedViaKeyboardRef = useRef(false);
5
+ if (isOpen && !wasOpenRef.current && navigatedViaKeyboardRef) {
6
+ localOpenedViaKeyboardRef.current = navigatedViaKeyboardRef.current;
7
+ navigatedViaKeyboardRef.current = false;
8
+ }
9
+ wasOpenRef.current = isOpen;
10
+ return localOpenedViaKeyboardRef.current;
11
+ }
@@ -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,73 @@
1
+ import { useCallback } from "react";
2
+ import { findFirstFocusable } from "./findFirstFocusable";
3
+ import { findLastFocusable } from "./findLastFocusable";
4
+ import { findNextFocusable } from "./findNextFocusable";
5
+ import { findPrevFocusable } from "./findPrevFocusable";
6
+ import { isButton } from "./isButton";
7
+ import { isLink } from "./isLink";
8
+ import { resolveKeys, verticalKeys } from "./resolveKeys";
9
+ export const useMenuListKeyboardNav = (keyboardActiveRef, navigatedViaKeyboardRef, isHorizontal) => {
10
+ const handleNavigation = useCallback(
11
+ // eslint-disable-next-line complexity
12
+ (e, keyMap) => {
13
+ var _a, _b, _c, _d, _e, _f;
14
+ keyboardActiveRef.current = true;
15
+ const target = e.target;
16
+ const currentTarget = e.currentTarget;
17
+ if (!isButton(target) && !isLink(target)) {
18
+ if (target === currentTarget) {
19
+ const menuList = currentTarget.querySelector("ul");
20
+ if (menuList) {
21
+ if (e.key === keyMap.keyNext || e.key === "Home") {
22
+ e.preventDefault();
23
+ (_a = findFirstFocusable(menuList)) === null || _a === void 0 ? void 0 : _a.focus();
24
+ }
25
+ else if (e.key === keyMap.keyPrev || e.key === "End") {
26
+ e.preventDefault();
27
+ (_b = findLastFocusable(menuList)) === null || _b === void 0 ? void 0 : _b.focus();
28
+ }
29
+ }
30
+ }
31
+ return;
32
+ }
33
+ const isItemWithChildren = (e.key === keyMap.keyOpenNested || e.key === "Enter" || e.key === " ") &&
34
+ target.classList.contains("zen-menu-button__action--has-children");
35
+ const isBackButton = (e.key === keyMap.keyBack || e.key === "Enter" || e.key === " ") && target.dataset.id === "root";
36
+ if (e.key === keyMap.keyNext) {
37
+ e.preventDefault();
38
+ (_c = findNextFocusable(target)) === null || _c === void 0 ? void 0 : _c.focus();
39
+ return;
40
+ }
41
+ if (e.key === keyMap.keyPrev) {
42
+ e.preventDefault();
43
+ (_d = findPrevFocusable(target)) === null || _d === void 0 ? void 0 : _d.focus();
44
+ return;
45
+ }
46
+ if (e.key === "Home") {
47
+ e.preventDefault();
48
+ (_e = findFirstFocusable(target)) === null || _e === void 0 ? void 0 : _e.focus();
49
+ return;
50
+ }
51
+ if (e.key === "End") {
52
+ e.preventDefault();
53
+ (_f = findLastFocusable(target)) === null || _f === void 0 ? void 0 : _f.focus();
54
+ return;
55
+ }
56
+ if (isButton(target) && (isItemWithChildren || isBackButton)) {
57
+ e.preventDefault();
58
+ navigatedViaKeyboardRef.current = true;
59
+ target.click();
60
+ }
61
+ }, [keyboardActiveRef, navigatedViaKeyboardRef]);
62
+ const onKeyDown = useCallback((e) => {
63
+ handleNavigation(e, resolveKeys(e.target, isHorizontal));
64
+ }, [isHorizontal, handleNavigation]);
65
+ const onKeyDownVertical = useCallback((e) => {
66
+ handleNavigation(e, verticalKeys);
67
+ }, [handleNavigation]);
68
+ const onMouseDown = useCallback(() => {
69
+ keyboardActiveRef.current = false;
70
+ // eslint-disable-next-line react-hooks/exhaustive-deps
71
+ }, []);
72
+ return { onKeyDown, onKeyDownVertical, onMouseDown };
73
+ };
@@ -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,31 @@
1
+ import { useState, useCallback, useEffect } from "react";
2
+ export const useMenuPath = (isOpen) => {
3
+ const [path, setPath] = useState([]);
4
+ useEffect(() => {
5
+ if (isOpen === false) {
6
+ setPath(v => (v.length ? [] : v));
7
+ }
8
+ }, [isOpen]);
9
+ const onOpenBranch = useCallback((branchId) => {
10
+ if (!branchId) {
11
+ return;
12
+ }
13
+ setPath(v => {
14
+ if (!v.includes(branchId)) {
15
+ return [...v, branchId];
16
+ }
17
+ const newPath = [...v];
18
+ newPath.pop();
19
+ return newPath;
20
+ });
21
+ }, []);
22
+ const closeBranch = useCallback(() => {
23
+ setPath(v => {
24
+ const newPath = [...v];
25
+ newPath.pop();
26
+ return newPath;
27
+ });
28
+ }, []);
29
+ const closeAll = useCallback(() => setPath([]), []);
30
+ return { path, onOpenBranch, closeBranch, closeAll };
31
+ };
@@ -14,7 +14,9 @@ import { classNames } from "../../commonHelpers/classNames/classNames";
14
14
  import { useRef, useState, useEffect, Children, cloneElement, createContext, useContext, useId } from "react";
15
15
  import { IconBeta } from "../../icons/iconBeta";
16
16
  import { IconChevronRight } from "../../icons/iconChevronRight";
17
+ import { IconChevronLeft } from "../../icons/iconChevronLeft";
17
18
  import { IconOpen2 } from "../../icons/iconOpen2";
19
+ import { useDirectionalIcon } from "../../utils/localization/useDirectionalIcon";
18
20
  import { Tooltip } from "../../tooltip/tooltip";
19
21
  import { ControlledMenu } from "../../menu/controlledMenu";
20
22
  import { useNavContext } from "../context/nav.context";
@@ -26,11 +28,12 @@ const defaultTooltipAlignment = "right";
26
28
  const isLinkNavItem = (item) => !!item.link;
27
29
  const NavItemContent = ({ primaryIcon, secondaryIcon, isBeta, counter, collapsed, hasSubmenu, iconClass, level = 1, children }) => {
28
30
  const primaryIconRef = useRef(null);
31
+ const ChevronIcon = useDirectionalIcon(IconChevronRight, IconChevronLeft);
29
32
  const PrimaryIconComponent = typeof primaryIcon === "function" ? primaryIcon : null;
30
33
  const SecondaryIconComponent = secondaryIcon;
31
34
  const iconSize = level > 1 ? SUBMENU_ICON_SIZE : ICON_SIZE;
32
35
  const primaryIconComponent = primaryIcon ? (_jsx("span", { ref: primaryIconRef, className: classNames(["zen-nav-item__icon", counter ? "zen-nav-item__icon--with-counter" : "", iconClass || ""]), children: PrimaryIconComponent ? _jsx(PrimaryIconComponent, { size: iconSize }) : primaryIcon })) : null;
33
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "zen-nav-item__content-left", children: [isBeta && !collapsed ? (_jsx("span", { className: "zen-nav-item__beta", children: _jsx(IconBeta, { size: "big" }) })) : null, primaryIconComponent, SecondaryIconComponent && !collapsed ? (_jsx("span", { className: "zen-nav-item__icon", children: _jsx(SecondaryIconComponent, { size: iconSize }) })) : null, !collapsed ? _jsx("span", { className: "zen-nav-item__title", children: children }) : null] }), !collapsed && (counter || hasSubmenu) ? (_jsxs("div", { className: "zen-nav-item__content-right", children: [counter ? _jsx("div", { className: "zen-nav-item__counter", children: counter }) : null, hasSubmenu ? _jsx(IconChevronRight, { className: "zen-nav-item__title-icon", size: iconSize }) : null] })) : null] }));
36
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "zen-nav-item__content-left", children: [isBeta && !collapsed ? (_jsx("span", { className: "zen-nav-item__beta", children: _jsx(IconBeta, { size: "big" }) })) : null, primaryIconComponent, SecondaryIconComponent && !collapsed ? (_jsx("span", { className: "zen-nav-item__icon", children: _jsx(SecondaryIconComponent, { size: iconSize }) })) : null, !collapsed ? _jsx("span", { className: "zen-nav-item__title", children: children }) : null] }), !collapsed && (counter || hasSubmenu) ? (_jsxs("div", { className: "zen-nav-item__content-right", children: [counter ? _jsx("div", { className: "zen-nav-item__counter", children: counter }) : null, hasSubmenu ? _jsx(ChevronIcon, { className: "zen-nav-item__title-icon", size: iconSize }) : null] })) : null] }));
34
37
  };
35
38
  const NavItemAction = ({ actionIcon, actionIconTitle = "", onActionIconClick, collapsed, isMenuItem, level = 1 }) => {
36
39
  const ActionIconComponent = actionIcon;
@@ -91,17 +94,19 @@ const ButtonNavItem = (_a) => {
91
94
  }
92
95
  };
93
96
  const handleKeyPress = evt => {
94
- if (evt.key !== "ArrowRight") {
97
+ if (hasNestedItems && (evt.key === "Enter" || evt.key === " ")) {
98
+ evt.preventDefault();
99
+ setMenuOpen(true);
95
100
  return;
96
101
  }
97
- if (hasNestedItems) {
98
- setMenuOpen(prevOpen => !prevOpen);
102
+ if (hasNestedItems && evt.key === "ArrowRight") {
103
+ setMenuOpen(true);
99
104
  }
100
105
  };
101
106
  const isMobile = useMobile();
102
107
  const isActive = active || (hasNestedItems && menuOpen);
103
108
  const triggerId = useId();
104
- const buttonElement = (_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: _jsx(NavItemContent, Object.assign({ title: title, collapsed: collapsed, hasSubmenu: hasNestedItems, level: currentLevel }, rest, { children: _jsx("span", { className: "zen-nav-item__title-text", children: title }) })) }));
109
+ const buttonElement = (_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: _jsx(NavItemContent, Object.assign({ title: title, collapsed: collapsed, hasSubmenu: hasNestedItems, level: currentLevel }, rest, { children: _jsx("span", { className: "zen-nav-item__title-text", children: title }) })) }));
105
110
  const trigger = collapsed ? (_jsx(Tooltip, { trigger: buttonElement, alignment: tooltipAlignment, children: title })) : (buttonElement);
106
111
  if (hasNestedItems) {
107
112
  // Process children to add appropriate level classes while allowing unlimited nesting
@@ -3,6 +3,7 @@ import { classNames } from "../../commonHelpers/classNames/classNames";
3
3
  import { Children, cloneElement, isValidElement, useCallback, useEffect, useMemo, useRef } from "react";
4
4
  import { useNavContext } from "../context/nav.context";
5
5
  import { NavItem } from "../navItem/navItem";
6
+ 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; };
6
7
  /**
7
8
  * @beta This component is not fully ready yet and may change in future releases.
8
9
  */
@@ -23,11 +24,11 @@ export const NavSection = ({ children, className }) => {
23
24
  if (!sectionRef.current) {
24
25
  return;
25
26
  }
26
- const navItemElements = sectionRef.current.querySelectorAll(".zen-nav-item");
27
+ const navItemElements = sectionRef.current.querySelectorAll(":scope > .zen-nav-item");
27
28
  childRefs.current = Array.from(navItemElements);
28
29
  }, [children]);
29
30
  const arrowClickHandler = useCallback(evt => {
30
- var _a, _b, _c;
31
+ var _a;
31
32
  const key = evt.key;
32
33
  if ((key !== "ArrowDown" && key !== "ArrowUp" && key !== "Home" && key !== "End" && key !== "PageUp" && key !== "PageDown") || // non-handled keys
33
34
  !children || // section is empty
@@ -36,7 +37,7 @@ export const NavSection = ({ children, className }) => {
36
37
  return;
37
38
  }
38
39
  evt.preventDefault();
39
- (_a = childRefs.current[focusedIndex.current]) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "-1");
40
+ (_a = getNavItemMain(childRefs.current[focusedIndex.current])) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "-1");
40
41
  if (key === "ArrowDown") {
41
42
  // get next in a loop
42
43
  focusedIndex.current = focusedIndex.current === Children.count(children) - 1 ? 0 : focusedIndex.current + 1;
@@ -51,8 +52,9 @@ export const NavSection = ({ children, className }) => {
51
52
  if (key === "End" || key === "PageDown") {
52
53
  focusedIndex.current = Children.count(children) - 1;
53
54
  }
54
- (_b = childRefs.current[focusedIndex.current]) === null || _b === void 0 ? void 0 : _b.setAttribute("tabindex", "0");
55
- (_c = childRefs.current[focusedIndex.current]) === null || _c === void 0 ? void 0 : _c.focus();
55
+ const nextMain = getNavItemMain(childRefs.current[focusedIndex.current]);
56
+ nextMain === null || nextMain === void 0 ? void 0 : nextMain.setAttribute("tabindex", "0");
57
+ nextMain === null || nextMain === void 0 ? void 0 : nextMain.focus();
56
58
  }, [children]);
57
59
  const cssClasses = classNames(["zen-nav-section", className || "", collapsed ? "zen-nav-section--collapsed" : ""]);
58
60
  return (_jsx("div", { ref: sectionRef, role: "menu", className: cssClasses, onKeyDown: arrowClickHandler, children: focusableChildren }));
@@ -1,13 +1,15 @@
1
1
  import { injectString } from "../utils/localization/translationsDictionary";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { classNames } from "../commonHelpers/classNames/classNames";
4
3
  import { SvgIconSize } from "../svgIcon/svgIconSize";
5
4
  import { PaginationType } from "./paginationType";
6
5
  import { ButtonIconPosition, TextIconButton } from "../textIconButton/textIconButton";
7
6
  import { ButtonType } from "../button/buttonType";
8
7
  import { useLanguage } from "../utils/localization/useLanguage";
9
8
  import { IconChevronRight } from "../icons/iconChevronRight";
9
+ import { IconChevronLeft } from "../icons/iconChevronLeft";
10
10
  import { IconArrowRight } from "../icons/iconArrowRight";
11
+ import { IconArrowLeft } from "../icons/iconArrowLeft";
12
+ import { useDirectionalIcon } from "../utils/localization/useDirectionalIcon";
11
13
  injectString("cs", "Previous page", "P\u0159edchoz\xED str\xE1nka");
12
14
  injectString("da-DK", "Previous page", "Forrige side");
13
15
  injectString("de", "Previous page", "Vorherige Seite");
@@ -71,6 +73,11 @@ export const PaginationArrow = ({
71
73
  const {
72
74
  translate
73
75
  } = useLanguage();
76
+ const isPrevious = value === "previous";
77
+ const [ltrCompact, rtlCompact] = isPrevious ? [IconChevronLeft, IconChevronRight] : [IconChevronRight, IconChevronLeft];
78
+ const [ltrNormal, rtlNormal] = isPrevious ? [IconArrowLeft, IconArrowRight] : [IconArrowRight, IconArrowLeft];
79
+ const CompactIcon = useDirectionalIcon(ltrCompact, rtlCompact);
80
+ const NormalIcon = useDirectionalIcon(ltrNormal, rtlNormal);
74
81
  const previousButtonTitle = translate("Previous page");
75
82
  const nextButtonTitle = translate("Next page");
76
83
  const buttonTitle = value === "next" ? nextButtonTitle : previousButtonTitle;
@@ -82,10 +89,10 @@ export const PaginationArrow = ({
82
89
  disabled: disabled,
83
90
  onClick: arrowButtonHandler,
84
91
  type: type === PaginationType.Compact ? ButtonType.TertiaryBlack : ButtonType.Secondary,
85
- icon: type === PaginationType.Compact ? IconChevronRight : IconArrowRight,
92
+ icon: type === PaginationType.Compact ? CompactIcon : NormalIcon,
86
93
  iconSize: type === PaginationType.Compact ? SvgIconSize.Big : SvgIconSize.Large,
87
94
  iconPosition: ButtonIconPosition.Start,
88
- iconClasses: classNames(["zen-pagination__arrow-navigation-button-icon", value === "previous" ? "zen-pagination__arrow-navigation-button-icon--rotate" : ""])
95
+ iconClasses: "zen-pagination__arrow-navigation-button-icon"
89
96
  });
90
97
  };
91
98
  export const TRANSLATIONS = ["Previous page", "Next page"];
@@ -63,6 +63,7 @@ export const RadioGroupRaw = (props) => {
63
63
  "zen-radio-group__item",
64
64
  wrappedInLabel ? "zen-radio-group__item--no-paddings" : "",
65
65
  type === "interactive" ? "zen-radio--interactive" : "",
66
- size === "small" ? "zen-radio-group__item--small" : ""
66
+ size === "small" ? "zen-radio-group__item--small" : "",
67
+ direction === "horizontal" ? "zen-radio--align-start" : ""
67
68
  ]), 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`))) })) }));
68
69
  };
@@ -419,7 +419,6 @@ export const RangeRaw = props => {
419
419
  className: classNames(["zen-range-popup zen-shadow-dropdown-default", className ? className : ""]),
420
420
  onOpenChange: handleTriggerClick,
421
421
  useTrapFocusWithTrigger: "on",
422
- alignment: "bottom-left",
423
422
  shouldHoldScroll: true,
424
423
  triggerRef: triggerRef,
425
424
  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;
@@ -35,19 +35,44 @@ export const searchItemIndex = (items, searchStr) => {
35
35
  return content.toLocaleLowerCase().indexOf(searchStr.toLocaleLowerCase()) > -1;
36
36
  });
37
37
  };
38
- export const getFirstIndex = (items) => (items.length > 0 ? 0 : -1);
39
- export const getLastIndex = (items) => (items.length > 0 ? items.length - 1 : -1);
38
+ export const getFirstIndex = (items) => items.findIndex(item => !item.disabled);
39
+ export const getLastIndex = (items) => {
40
+ for (let i = items.length - 1; i >= 0; i--) {
41
+ if (!items[i].disabled) {
42
+ return i;
43
+ }
44
+ }
45
+ return -1;
46
+ };
40
47
  export const getNextIndex = (currIndex, items) => {
48
+ var _a;
41
49
  if (items.length === 0) {
42
50
  return -1;
43
51
  }
44
- return currIndex + 1 >= items.length ? 0 : currIndex + 1;
52
+ let nextIndex = currIndex + 1 >= items.length ? 0 : currIndex + 1;
53
+ const startIndex = nextIndex;
54
+ while ((_a = items[nextIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
55
+ nextIndex = nextIndex + 1 >= items.length ? 0 : nextIndex + 1;
56
+ if (nextIndex === startIndex) {
57
+ return currIndex;
58
+ }
59
+ }
60
+ return nextIndex;
45
61
  };
46
62
  export const getPrevIndex = (currIndex, items) => {
63
+ var _a;
47
64
  if (items.length === 0) {
48
65
  return -1;
49
66
  }
50
- return currIndex <= 0 || currIndex >= items.length ? items.length - 1 : currIndex - 1;
67
+ let prevIndex = currIndex <= 0 || currIndex >= items.length ? items.length - 1 : currIndex - 1;
68
+ const startIndex = prevIndex;
69
+ while ((_a = items[prevIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
70
+ prevIndex = prevIndex <= 0 ? items.length - 1 : prevIndex - 1;
71
+ if (prevIndex === startIndex) {
72
+ return currIndex;
73
+ }
74
+ }
75
+ return prevIndex;
51
76
  };
52
77
  export const getFirstActiveIndex = (state, items, multiselect) => {
53
78
  for (let i = 0; i < items.length; i++) {
@@ -48,7 +48,9 @@ export const SelectList = (_a) => {
48
48
  if (!multiselect && selectItemOnFocus) {
49
49
  dispatchState({ type: ListAction.FocusFirst, payload: { items } });
50
50
  }
51
- dispatchState({ type: ListAction.Focus, payload: { items, multiselect } });
51
+ if (!multiselect) {
52
+ dispatchState({ type: ListAction.Focus, payload: { items, multiselect } });
53
+ }
52
54
  }, [multiselect, items, selectItemOnFocus]);
53
55
  useEffect(() => {
54
56
  onChange && state.isItemsStateChanged && onChange(new Map(state.itemsState));
@@ -117,8 +117,7 @@ export const selectListReducer = (state, action) => {
117
117
  newItemsState = updatedState;
118
118
  });
119
119
  const prevActiveItemId = getItemIdByIndex(state.itemsState, state.activeIndex);
120
- const newActiveItemIndex = !!prevActiveItemId && getItemIndexById(newItemsState, prevActiveItemId);
121
- const activeIndex = newActiveItemIndex ? newActiveItemIndex : -1;
120
+ const activeIndex = prevActiveItemId !== undefined ? getItemIndexById(newItemsState, prevActiveItemId) : -1;
122
121
  return Object.assign(Object.assign({}, state), { itemsState: newItemsState, activeIndex, isItemsStateChanged: false });
123
122
  }
124
123
  case ListAction.SetLevel: {
@@ -3,9 +3,12 @@ import { CheckboxState } from "../checkbox/checkboxState";
3
3
  import { CheckboxNonInteractive } from "../checkboxNonInteractive/checkboxNonInteractive";
4
4
  import { classNames } from "../commonHelpers/classNames/classNames";
5
5
  import { IconChevronRight } from "../icons/iconChevronRight";
6
+ import { IconChevronLeft } from "../icons/iconChevronLeft";
7
+ import { useDirectionalIcon } from "../utils/localization/useDirectionalIcon";
6
8
  import { useDriveClassName } from "../utils/theme/useDriveClassName";
7
9
  export const SelectListItem = ({ id, disabled = false, state = CheckboxState.Off, showCheckbox = false, focused = false, onChange, onClick, multiLevel, className = "", children }) => {
8
10
  const driveClassName = useDriveClassName("zen-select-item");
11
+ const ChevronIcon = useDirectionalIcon(IconChevronRight, IconChevronLeft);
9
12
  const onClickFunc = () => {
10
13
  if (disabled) {
11
14
  return;
@@ -27,5 +30,5 @@ export const SelectListItem = ({ id, disabled = false, state = CheckboxState.Off
27
30
  "zen-select-item__wrapper",
28
31
  "zen-ellipsis",
29
32
  multiLevel ? "zen-select-item__wrapper--with-arrow" : ""
30
- ]), children: [showCheckbox ? (_jsx(CheckboxNonInteractive, { className: "zen-select-item__control-view", checked: state === CheckboxState.On, indeterminate: state === CheckboxState.Indeterminate, disabled: disabled, children: children })) : (children), multiLevel && !showCheckbox ? _jsx(IconChevronRight, { size: "large" }) : null] }) }));
33
+ ]), children: [showCheckbox ? (_jsx(CheckboxNonInteractive, { className: "zen-select-item__control-view", checked: state === CheckboxState.On, indeterminate: state === CheckboxState.Indeterminate, disabled: disabled, children: children })) : (children), multiLevel && !showCheckbox ? _jsx(ChevronIcon, { size: "large" }) : null] }) }));
31
34
  };
@@ -65,6 +65,60 @@ injectString("zh-Hans", "Change sort direction", "\u66F4\u6539\u6392\u5E8F");
65
65
  injectString("zh-TW", "Change sort direction", "\u8B8A\u66F4\u6392\u5E8F\u65B9\u5411");
66
66
  injectString("ro-RO", "Change sort direction", "Schimba\u021Bi direc\u021Bia sort\u0103rii");
67
67
  injectString("ar-SA", "Change sort direction", "\u062A\u063A\u064A\u064A\u0631 \u0627\u062A\u062C\u0627\u0647 \u0627\u0644\u062A\u0631\u062A\u064A\u0628");
68
+ injectString("cs", "Ascending", "Vzestupn\u011B");
69
+ injectString("da-DK", "Ascending", "Stigende");
70
+ injectString("de", "Ascending", "Aufsteigend");
71
+ injectString("en", "Ascending", "Ascending");
72
+ injectString("es", "Ascending", "Ascendente");
73
+ injectString("fi-FI", "Ascending", "Nouseva");
74
+ injectString("fr", "Ascending", "Croissant");
75
+ injectString("fr-FR", "Ascending", "Croissant");
76
+ injectString("hu-HU", "Ascending", "N\xF6vekv\u0151");
77
+ injectString("id", "Ascending", "Naik");
78
+ injectString("it", "Ascending", "Crescente");
79
+ injectString("ja", "Ascending", "\u6607\u9806");
80
+ injectString("ko-KR", "Ascending", "\uC624\uB984\uCC28\uC21C");
81
+ injectString("ms", "Ascending", "Menaik");
82
+ injectString("nb-NO", "Ascending", "Stigende");
83
+ injectString("nl", "Ascending", "Oplopend");
84
+ injectString("pl", "Ascending", "Rosn\u0105co");
85
+ injectString("pt-BR", "Ascending", "Crescente");
86
+ injectString("pt-PT", "Ascending", "Ascendente");
87
+ injectString("sk-SK", "Ascending", "Vzostupne");
88
+ injectString("sv", "Ascending", "Stigande");
89
+ injectString("th", "Ascending", "\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01");
90
+ injectString("tr", "Ascending", "Artan");
91
+ injectString("zh-Hans", "Ascending", "\u5347\u5E8F");
92
+ injectString("zh-TW", "Ascending", "\u905E\u589E");
93
+ injectString("ro-RO", "Ascending", "Ascensiune");
94
+ injectString("ar-SA", "Ascending", "\u062A\u0635\u0627\u0639\u062F\u064A");
95
+ injectString("cs", "Descending", "Sestupn\u011B");
96
+ injectString("da-DK", "Descending", "Faldende");
97
+ injectString("de", "Descending", "Absteigend");
98
+ injectString("en", "Descending", "Descending");
99
+ injectString("es", "Descending", "Descendente");
100
+ injectString("fi-FI", "Descending", "Laskeva");
101
+ injectString("fr", "Descending", "D\xE9croissant");
102
+ injectString("fr-FR", "Descending", "Descendant");
103
+ injectString("hu-HU", "Descending", "Cs\xF6kken\u0151");
104
+ injectString("id", "Descending", "Menurun");
105
+ injectString("it", "Descending", "Decrescente");
106
+ injectString("ja", "Descending", "\u964D\u9806");
107
+ injectString("ko-KR", "Descending", "\uB0B4\uB9BC\uCC28\uC21C");
108
+ injectString("ms", "Descending", "Menurun");
109
+ injectString("nb-NO", "Descending", "Synkende");
110
+ injectString("nl", "Descending", "Aflopend");
111
+ injectString("pl", "Descending", "Malej\u0105co");
112
+ injectString("pt-BR", "Descending", "Decrescente");
113
+ injectString("pt-PT", "Descending", "Descendente");
114
+ injectString("sk-SK", "Descending", "Zostupne");
115
+ injectString("sv", "Descending", "Fallande");
116
+ injectString("th", "Descending", "\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22");
117
+ injectString("tr", "Descending", "Azalan");
118
+ injectString("zh-Hans", "Descending", "\u964D\u5E8F");
119
+ injectString("zh-TW", "Descending", "\u905E\u6E1B");
120
+ injectString("ro-RO", "Descending", "Cobor\xE2re");
121
+ injectString("ar-SA", "Descending", "\u062A\u0646\u0627\u0632\u0644\u064A");
68
122
  injectString("cs", "Sort Options", "Sort Options");
69
123
  injectString("da-DK", "Sort Options", "Sorteringsmuligheder");
70
124
  injectString("de", "Sort Options", "Sort Options");
@@ -92,7 +146,6 @@ injectString("zh-Hans", "Sort Options", "Sort Options");
92
146
  injectString("zh-TW", "Sort Options", "\u6392\u5E8F\u9078\u9805");
93
147
  injectString("ro-RO", "Sort Options", "Op\u021Biuni de sortare");
94
148
  injectString("ar-SA", "Sort Options", "\u062E\u064A\u0627\u0631\u0627\u062A \u0627\u0644\u062A\u0631\u062A\u064A\u0628");
95
- const MENU_POSITION = "bottom-left";
96
149
  const BUTTON_TEXT_DEFAULT = "Sort by";
97
150
  export var SortDirections;
98
151
  (function (SortDirections) {
@@ -149,7 +202,6 @@ export const SortControl = ({
149
202
  onClick: () => onSortDirectionToggle(),
150
203
  disabled: disabled,
151
204
  title: translate("Change sort direction"),
152
- "aria-label": translate("Change sort direction"),
153
205
  children: [directionIcon ? sortDirection === SortDirections.Ascending ? _jsx(IconFilter3Asc, {
154
206
  className: "zen-sort-container__sort-icon",
155
207
  size: isDrive ? "huge" : "large"
@@ -162,6 +214,9 @@ export const SortControl = ({
162
214
  children: [buttonTextValue, ": "]
163
215
  }), _jsx("span", {
164
216
  children: (items.find(item => item.id === sortBy) || items[0]).children
217
+ }), _jsxs("span", {
218
+ className: "zen-visually-hidden",
219
+ children: [" ", sortDirection === SortDirections.Ascending ? translate("Ascending") : translate("Descending")]
165
220
  })]
166
221
  })]
167
222
  }), isSingleItem ? "" : _jsx(Popup, {
@@ -175,7 +230,7 @@ export const SortControl = ({
175
230
  size: isDrive ? "huge" : "large"
176
231
  })
177
232
  }),
178
- alignment: MENU_POSITION,
233
+ alignment: "bottom-left",
179
234
  onOpenChange: isCurrentlyOpen => onOptionsToggle(isCurrentlyOpen),
180
235
  children: _jsx(SelectList, {
181
236
  id: "sortControlSelectList",
@@ -188,4 +243,4 @@ export const SortControl = ({
188
243
  }, popupKey)]
189
244
  });
190
245
  };
191
- export const TRANSLATIONS = ["Sort by", "Sort Options", "Change sort direction"];
246
+ export const TRANSLATIONS = ["Sort by", "Sort Options", "Change sort direction", "Ascending", "Descending"];
@@ -1,5 +1,5 @@
1
1
  import { ReactElement, ReactNode, RefObject } from "react";
2
- export declare const useTableChildren: (children: ReactNode, isMobile: boolean, selected: number, allSelected: boolean, clearSelection: () => void, selectAll: () => void, turnOffSelectAll?: boolean, activeId?: string, gridRef?: RefObject<HTMLElement | null>, onCloseDetailPanel?: () => void) => {
2
+ export declare const useTableChildren: (children: ReactNode, isMobile: boolean, selected: number, allSelected: boolean, clearSelection: () => void, activeId?: string, gridRef?: RefObject<HTMLElement | null>, onCloseDetailPanel?: () => void) => {
3
3
  bulkActions: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
4
4
  pagination: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
5
5
  activePage: number | undefined;
@@ -24,7 +24,7 @@ const isChildElement = function (child, expectedType) {
24
24
  }
25
25
  return false;
26
26
  };
27
- export const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, selectAll, turnOffSelectAll, activeId, gridRef, onCloseDetailPanel) => useMemo(() => {
27
+ export const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, activeId, gridRef, onCloseDetailPanel) => useMemo(() => {
28
28
  let bulkActions = undefined;
29
29
  let tablePagination = undefined;
30
30
  let activePage = undefined;
@@ -39,7 +39,7 @@ export const useTableChildren = (children, isMobile, selected, allSelected, clea
39
39
  }
40
40
  if (isChildElement(child, TableBulkActions.displayName)) {
41
41
  const bulkActionButtons = child.props.children || [];
42
- bulkActions = (_jsx(BulkActions, { gridType: isMobile ? DeviceType.Mobile : DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, onSelectAll: selectAll, turnOffSelectAll: turnOffSelectAll, children: bulkActionButtons }));
42
+ bulkActions = (_jsx(BulkActions, { gridType: isMobile ? DeviceType.Mobile : DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, children: bulkActionButtons }));
43
43
  return;
44
44
  }
45
45
  if (isChildElement(child, TablePagination.displayName)) {
@@ -100,4 +100,4 @@ export const useTableChildren = (children, isMobile, selected, allSelected, clea
100
100
  detailPanel: detailPanel,
101
101
  other: other
102
102
  };
103
- }, [children, clearSelection, isMobile, selected, gridRef, allSelected, selectAll, turnOffSelectAll, activeId, onCloseDetailPanel]);
103
+ }, [children, clearSelection, isMobile, selected, gridRef, allSelected, activeId, onCloseDetailPanel]);