@geotab/zenith 3.10.0 → 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 (311) hide show
  1. package/README.md +29 -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 +3254 -2922
  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/listItem/listItem.js +4 -1
  67. package/dist/menu/components/controlledMenuList/controlledMenuList.d.ts +27 -0
  68. package/dist/menu/components/controlledMenuList/controlledMenuList.js +126 -0
  69. package/dist/menu/components/createControlledMenuList.d.ts +37 -0
  70. package/dist/menu/components/createControlledMenuList.js +55 -0
  71. package/dist/menu/components/createMenuItem.d.ts +67 -0
  72. package/dist/menu/components/createMenuItem.js +97 -0
  73. package/dist/menu/components/menuButton.js +12 -3
  74. package/dist/menu/components/menuItem.d.ts +1 -2
  75. package/dist/menu/components/menuItem.js +20 -74
  76. package/dist/menu/contexts/usePathContext.d.ts +2 -0
  77. package/dist/menu/contexts/usePathContext.js +9 -0
  78. package/dist/menu/controlledMenu.js +8 -175
  79. package/dist/menu/utils/buildMenuContent.d.ts +2 -0
  80. package/dist/menu/utils/buildMenuContent.js +38 -0
  81. package/dist/menu/utils/findContent.d.ts +2 -2
  82. package/dist/menu/utils/findContent.js +4 -3
  83. package/dist/menu/utils/getItemLabel.d.ts +2 -0
  84. package/dist/menu/utils/getItemLabel.js +8 -0
  85. package/dist/menu/utils/getSafeRel.d.ts +1 -0
  86. package/dist/menu/utils/getSafeRel.js +14 -0
  87. package/dist/menu/utils/isMenuItem.d.ts +2 -0
  88. package/dist/menu/utils/isMenuItem.js +13 -0
  89. package/dist/menu/utils/isSafeHref.d.ts +1 -0
  90. package/dist/menu/utils/isSafeHref.js +10 -0
  91. package/dist/menu/utils/normalizeSeparators.d.ts +2 -0
  92. package/dist/menu/utils/normalizeSeparators.js +23 -0
  93. package/dist/menu/utils/resolveKeys.d.ts +12 -0
  94. package/dist/menu/utils/resolveKeys.js +22 -0
  95. package/dist/menu/utils/useLastValidSheet.d.ts +7 -0
  96. package/dist/menu/utils/useLastValidSheet.js +30 -0
  97. package/dist/menu/utils/useMenuItemCore.d.ts +31 -0
  98. package/dist/menu/utils/useMenuItemCore.js +54 -0
  99. package/dist/menu/utils/useMenuItemKeyboardNav.d.ts +2 -0
  100. package/dist/menu/utils/useMenuItemKeyboardNav.js +15 -0
  101. package/dist/menu/utils/useMenuListKeyboardNav.d.ts +12 -0
  102. package/dist/menu/utils/useMenuListKeyboardNav.js +77 -0
  103. package/dist/menu/utils/useMenuPath.d.ts +6 -0
  104. package/dist/menu/utils/useMenuPath.js +35 -0
  105. package/dist/nav/navItem/navItem.js +10 -5
  106. package/dist/nav/navSection/navSection.js +7 -5
  107. package/dist/pagination/paginationArrow.js +10 -3
  108. package/dist/radioGroupRaw/radioGroupRaw.js +2 -1
  109. package/dist/rangeRaw/rangeRaw.js +0 -1
  110. package/dist/selectList/selectList.helpers.d.ts +1 -1
  111. package/dist/selectList/selectList.helpers.js +29 -4
  112. package/dist/selectList/selectList.js +3 -1
  113. package/dist/selectList/selectList.reducer.js +1 -2
  114. package/dist/selectList/selectListItem.js +4 -1
  115. package/dist/sortControl/sortControl.js +59 -4
  116. package/dist/table/children/useTableChildren.d.ts +1 -1
  117. package/dist/table/children/useTableChildren.js +3 -3
  118. package/dist/table/flexible/columnsList.js +4 -2
  119. package/dist/table/selectable/useSelectableRows.d.ts +8 -0
  120. package/dist/table/selectable/useSelectableRows.js +14 -6
  121. package/dist/table/table.js +1 -7
  122. package/dist/tabs/tabs.js +60 -58
  123. package/dist/tabs/tabsTestHelper.js +2 -2
  124. package/dist/timePickerRaw/timePickerRaw.js +1 -1
  125. package/dist/toggleButtonRaw/toggleButtonRaw.js +5 -2
  126. package/dist/utils/localization/translations/ar.json +3 -1
  127. package/dist/utils/localization/translations/cs.json +9 -5
  128. package/dist/utils/localization/translations/da-DK.json +9 -5
  129. package/dist/utils/localization/translations/de.json +9 -5
  130. package/dist/utils/localization/translations/en.json +5 -1
  131. package/dist/utils/localization/translations/es.json +9 -5
  132. package/dist/utils/localization/translations/fi-FI.json +9 -5
  133. package/dist/utils/localization/translations/fr-FR.json +9 -5
  134. package/dist/utils/localization/translations/fr.json +9 -5
  135. package/dist/utils/localization/translations/hu-HU.json +9 -5
  136. package/dist/utils/localization/translations/id.json +9 -5
  137. package/dist/utils/localization/translations/it.json +9 -5
  138. package/dist/utils/localization/translations/ja.json +9 -5
  139. package/dist/utils/localization/translations/ko-KR.json +9 -5
  140. package/dist/utils/localization/translations/ms.json +9 -5
  141. package/dist/utils/localization/translations/nb-NO.json +9 -5
  142. package/dist/utils/localization/translations/nl.json +9 -5
  143. package/dist/utils/localization/translations/pl.json +9 -5
  144. package/dist/utils/localization/translations/pt-BR.json +9 -5
  145. package/dist/utils/localization/translations/pt-PT.json +9 -5
  146. package/dist/utils/localization/translations/ro-RO.json +9 -5
  147. package/dist/utils/localization/translations/sk-SK.json +9 -5
  148. package/dist/utils/localization/translations/sv.json +9 -5
  149. package/dist/utils/localization/translations/th.json +9 -5
  150. package/dist/utils/localization/translations/tr.json +9 -5
  151. package/dist/utils/localization/translations/zh-Hans.json +9 -5
  152. package/dist/utils/localization/translations/zh-TW.json +9 -5
  153. package/dist/utils/localization/useDirectionalIcon.d.ts +3 -0
  154. package/dist/utils/localization/useDirectionalIcon.js +9 -0
  155. package/dist/utils/positioningUtils/alignments.d.ts +2 -2
  156. package/dist/utils/positioningUtils/alignments.js +2 -2
  157. package/dist/utils/positioningUtils/calculatePosition.js +4 -6
  158. package/esm/calendar/calendar.js +7 -4
  159. package/esm/card/components/title.js +4 -1
  160. package/esm/card/components/titleLink.js +5 -2
  161. package/esm/chart/barChart/getDefaultOptions.d.ts +2 -1
  162. package/esm/chart/barChart/getDefaultOptions.js +5 -2
  163. package/esm/chart/barChart.js +6 -4
  164. package/esm/chart/lineChart/getDefaultOptions.d.ts +2 -1
  165. package/esm/chart/lineChart/getDefaultOptions.js +5 -2
  166. package/esm/chart/lineChart.js +4 -2
  167. package/esm/checkboxListWithAction/checkboxListWithAction.js +4 -1
  168. package/esm/commonHelpers/arrowNavigation/components/arrowButton/arrowButton.js +4 -1
  169. package/esm/controlledPopup/controlledPopup.d.ts +1 -0
  170. package/esm/controlledPopup/controlledPopup.js +3 -1
  171. package/esm/dataGrid/cell/cell.d.ts +2 -1
  172. package/esm/dataGrid/cell/cell.js +2 -2
  173. package/esm/dataGrid/dataGrid.js +7 -4
  174. package/esm/dataGrid/listColumn.d.ts +2 -0
  175. package/esm/dataGrid/row/row.d.ts +2 -1
  176. package/esm/dataGrid/row/row.js +13 -9
  177. package/esm/dataGrid/withFlexibleColumns/components/columnSettingsList.js +2 -1
  178. package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +4 -0
  179. package/esm/dateRangeInner/dateRangeInner.js +5 -2
  180. package/esm/dateRangeRaw/dateRangeRaw.js +5 -2
  181. package/esm/dateRangeRaw/utils/parseLabel.js +1 -1
  182. package/esm/dropdownRaw/dropdownRaw.js +12 -6
  183. package/esm/fileUpload/components/dropZoneContent.js +100 -100
  184. package/esm/fileUpload/fileUpload.js +100 -100
  185. package/esm/filters/components/filtersSearchList.js +4 -1
  186. package/esm/filtersBar/filtersContainer/filtersContainer.js +62 -61
  187. package/esm/formStepperButtons/formStepperButtons.js +4 -1
  188. package/esm/groupsFilterRaw/groupsFilterAdjustmentState.js +4 -1
  189. package/esm/groupsFilterRaw/groupsFilterInitialState.js +4 -1
  190. package/esm/header/headerBack.js +4 -1
  191. package/esm/icons/iconAlignLeft.js +1 -3
  192. package/esm/icons/iconAlignmentLeft.js +1 -3
  193. package/esm/icons/iconAlignmentRight.js +1 -3
  194. package/esm/icons/iconArrowBottomLeft.js +1 -3
  195. package/esm/icons/iconArrowBottomRight.js +1 -3
  196. package/esm/icons/iconArrowLeftPath.js +1 -3
  197. package/esm/icons/iconArrowRight.js +1 -3
  198. package/esm/icons/iconArrowRightCircle.js +1 -3
  199. package/esm/icons/iconArrowRightPath.js +1 -3
  200. package/esm/icons/iconArrowTopLeft.js +1 -3
  201. package/esm/icons/iconArrowTopRight.js +1 -3
  202. package/esm/icons/iconChevronDoubleRight.js +1 -3
  203. package/esm/icons/iconChevronRight.js +1 -3
  204. package/esm/icons/iconChevronRightSmall.js +1 -3
  205. package/esm/icons/iconCornerDownLeft.js +1 -3
  206. package/esm/icons/iconCornerDownRight.js +1 -3
  207. package/esm/icons/iconCornerLeftDown.js +1 -3
  208. package/esm/icons/iconCornerLeftUp.js +1 -3
  209. package/esm/icons/iconCornerRightDown.js +1 -3
  210. package/esm/icons/iconCornerRightUp.js +1 -3
  211. package/esm/icons/iconCornerUpLeft.js +1 -3
  212. package/esm/icons/iconCornerUpRight.js +1 -3
  213. package/esm/index.d.ts +1 -0
  214. package/esm/index.js +1 -0
  215. package/esm/lineChartMini/lineChartMini.js +15 -3
  216. package/esm/list/itemData/itemDataInternal.js +4 -1
  217. package/esm/list/listItem/listItem.js +4 -1
  218. package/esm/menu/components/controlledMenuList/controlledMenuList.d.ts +27 -0
  219. package/esm/menu/components/controlledMenuList/controlledMenuList.js +123 -0
  220. package/esm/menu/components/createControlledMenuList.d.ts +37 -0
  221. package/esm/menu/components/createControlledMenuList.js +51 -0
  222. package/esm/menu/components/createMenuItem.d.ts +67 -0
  223. package/esm/menu/components/createMenuItem.js +93 -0
  224. package/esm/menu/components/menuButton.js +12 -3
  225. package/esm/menu/components/menuItem.d.ts +1 -2
  226. package/esm/menu/components/menuItem.js +20 -74
  227. package/esm/menu/contexts/usePathContext.d.ts +2 -0
  228. package/esm/menu/contexts/usePathContext.js +5 -0
  229. package/esm/menu/controlledMenu.js +10 -177
  230. package/esm/menu/utils/buildMenuContent.d.ts +2 -0
  231. package/esm/menu/utils/buildMenuContent.js +34 -0
  232. package/esm/menu/utils/findContent.d.ts +2 -2
  233. package/esm/menu/utils/findContent.js +4 -3
  234. package/esm/menu/utils/getItemLabel.d.ts +2 -0
  235. package/esm/menu/utils/getItemLabel.js +4 -0
  236. package/esm/menu/utils/getSafeRel.d.ts +1 -0
  237. package/esm/menu/utils/getSafeRel.js +10 -0
  238. package/esm/menu/utils/isMenuItem.d.ts +2 -0
  239. package/esm/menu/utils/isMenuItem.js +9 -0
  240. package/esm/menu/utils/isSafeHref.d.ts +1 -0
  241. package/esm/menu/utils/isSafeHref.js +6 -0
  242. package/esm/menu/utils/normalizeSeparators.d.ts +2 -0
  243. package/esm/menu/utils/normalizeSeparators.js +19 -0
  244. package/esm/menu/utils/resolveKeys.d.ts +12 -0
  245. package/esm/menu/utils/resolveKeys.js +18 -0
  246. package/esm/menu/utils/useLastValidSheet.d.ts +7 -0
  247. package/esm/menu/utils/useLastValidSheet.js +26 -0
  248. package/esm/menu/utils/useMenuItemCore.d.ts +31 -0
  249. package/esm/menu/utils/useMenuItemCore.js +50 -0
  250. package/esm/menu/utils/useMenuItemKeyboardNav.d.ts +2 -0
  251. package/esm/menu/utils/useMenuItemKeyboardNav.js +11 -0
  252. package/esm/menu/utils/useMenuListKeyboardNav.d.ts +12 -0
  253. package/esm/menu/utils/useMenuListKeyboardNav.js +73 -0
  254. package/esm/menu/utils/useMenuPath.d.ts +6 -0
  255. package/esm/menu/utils/useMenuPath.js +31 -0
  256. package/esm/nav/navItem/navItem.js +10 -5
  257. package/esm/nav/navSection/navSection.js +7 -5
  258. package/esm/pagination/paginationArrow.js +10 -3
  259. package/esm/radioGroupRaw/radioGroupRaw.js +2 -1
  260. package/esm/rangeRaw/rangeRaw.js +0 -1
  261. package/esm/selectList/selectList.helpers.d.ts +1 -1
  262. package/esm/selectList/selectList.helpers.js +29 -4
  263. package/esm/selectList/selectList.js +3 -1
  264. package/esm/selectList/selectList.reducer.js +1 -2
  265. package/esm/selectList/selectListItem.js +4 -1
  266. package/esm/sortControl/sortControl.js +59 -4
  267. package/esm/table/children/useTableChildren.d.ts +1 -1
  268. package/esm/table/children/useTableChildren.js +3 -3
  269. package/esm/table/flexible/columnsList.js +4 -2
  270. package/esm/table/selectable/useSelectableRows.d.ts +8 -0
  271. package/esm/table/selectable/useSelectableRows.js +14 -6
  272. package/esm/table/table.js +1 -7
  273. package/esm/tabs/tabs.js +60 -58
  274. package/esm/tabs/tabsTestHelper.js +2 -2
  275. package/esm/testHelpers/mockAbsoluteAlignment.d.ts +1 -0
  276. package/esm/testHelpers/mockAbsoluteAlignment.js +10 -0
  277. package/esm/timePickerRaw/timePickerRaw.js +1 -1
  278. package/esm/toggleButtonRaw/toggleButtonRaw.js +5 -2
  279. package/esm/utils/localization/translations/ar.json +3 -1
  280. package/esm/utils/localization/translations/cs.json +9 -5
  281. package/esm/utils/localization/translations/da-DK.json +9 -5
  282. package/esm/utils/localization/translations/de.json +9 -5
  283. package/esm/utils/localization/translations/en.json +5 -1
  284. package/esm/utils/localization/translations/es.json +9 -5
  285. package/esm/utils/localization/translations/fi-FI.json +9 -5
  286. package/esm/utils/localization/translations/fr-FR.json +9 -5
  287. package/esm/utils/localization/translations/fr.json +9 -5
  288. package/esm/utils/localization/translations/hu-HU.json +9 -5
  289. package/esm/utils/localization/translations/id.json +9 -5
  290. package/esm/utils/localization/translations/it.json +9 -5
  291. package/esm/utils/localization/translations/ja.json +9 -5
  292. package/esm/utils/localization/translations/ko-KR.json +9 -5
  293. package/esm/utils/localization/translations/ms.json +9 -5
  294. package/esm/utils/localization/translations/nb-NO.json +9 -5
  295. package/esm/utils/localization/translations/nl.json +9 -5
  296. package/esm/utils/localization/translations/pl.json +9 -5
  297. package/esm/utils/localization/translations/pt-BR.json +9 -5
  298. package/esm/utils/localization/translations/pt-PT.json +9 -5
  299. package/esm/utils/localization/translations/ro-RO.json +9 -5
  300. package/esm/utils/localization/translations/sk-SK.json +9 -5
  301. package/esm/utils/localization/translations/sv.json +9 -5
  302. package/esm/utils/localization/translations/th.json +9 -5
  303. package/esm/utils/localization/translations/tr.json +9 -5
  304. package/esm/utils/localization/translations/zh-Hans.json +9 -5
  305. package/esm/utils/localization/translations/zh-TW.json +9 -5
  306. package/esm/utils/localization/useDirectionalIcon.d.ts +3 -0
  307. package/esm/utils/localization/useDirectionalIcon.js +5 -0
  308. package/esm/utils/positioningUtils/alignments.d.ts +2 -2
  309. package/esm/utils/positioningUtils/alignments.js +2 -2
  310. package/esm/utils/positioningUtils/calculatePosition.js +4 -6
  311. package/package.json +123 -122
@@ -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;
@@ -66,6 +66,60 @@ injectString("zh-Hans", "Change sort direction", "\u66F4\u6539\u6392\u5E8F");
66
66
  injectString("zh-TW", "Change sort direction", "\u8B8A\u66F4\u6392\u5E8F\u65B9\u5411");
67
67
  injectString("ro-RO", "Change sort direction", "Schimba\u021Bi direc\u021Bia sort\u0103rii");
68
68
  injectString("ar-SA", "Change sort direction", "\u062A\u063A\u064A\u064A\u0631 \u0627\u062A\u062C\u0627\u0647 \u0627\u0644\u062A\u0631\u062A\u064A\u0628");
69
+ injectString("cs", "Ascending", "Vzestupn\u011B");
70
+ injectString("da-DK", "Ascending", "Stigende");
71
+ injectString("de", "Ascending", "Aufsteigend");
72
+ injectString("en", "Ascending", "Ascending");
73
+ injectString("es", "Ascending", "Ascendente");
74
+ injectString("fi-FI", "Ascending", "Nouseva");
75
+ injectString("fr", "Ascending", "Croissant");
76
+ injectString("fr-FR", "Ascending", "Croissant");
77
+ injectString("hu-HU", "Ascending", "N\xF6vekv\u0151");
78
+ injectString("id", "Ascending", "Naik");
79
+ injectString("it", "Ascending", "Crescente");
80
+ injectString("ja", "Ascending", "\u6607\u9806");
81
+ injectString("ko-KR", "Ascending", "\uC624\uB984\uCC28\uC21C");
82
+ injectString("ms", "Ascending", "Menaik");
83
+ injectString("nb-NO", "Ascending", "Stigende");
84
+ injectString("nl", "Ascending", "Oplopend");
85
+ injectString("pl", "Ascending", "Rosn\u0105co");
86
+ injectString("pt-BR", "Ascending", "Crescente");
87
+ injectString("pt-PT", "Ascending", "Ascendente");
88
+ injectString("sk-SK", "Ascending", "Vzostupne");
89
+ injectString("sv", "Ascending", "Stigande");
90
+ injectString("th", "Ascending", "\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01");
91
+ injectString("tr", "Ascending", "Artan");
92
+ injectString("zh-Hans", "Ascending", "\u5347\u5E8F");
93
+ injectString("zh-TW", "Ascending", "\u905E\u589E");
94
+ injectString("ro-RO", "Ascending", "Ascensiune");
95
+ injectString("ar-SA", "Ascending", "\u062A\u0635\u0627\u0639\u062F\u064A");
96
+ injectString("cs", "Descending", "Sestupn\u011B");
97
+ injectString("da-DK", "Descending", "Faldende");
98
+ injectString("de", "Descending", "Absteigend");
99
+ injectString("en", "Descending", "Descending");
100
+ injectString("es", "Descending", "Descendente");
101
+ injectString("fi-FI", "Descending", "Laskeva");
102
+ injectString("fr", "Descending", "D\xE9croissant");
103
+ injectString("fr-FR", "Descending", "Descendant");
104
+ injectString("hu-HU", "Descending", "Cs\xF6kken\u0151");
105
+ injectString("id", "Descending", "Menurun");
106
+ injectString("it", "Descending", "Decrescente");
107
+ injectString("ja", "Descending", "\u964D\u9806");
108
+ injectString("ko-KR", "Descending", "\uB0B4\uB9BC\uCC28\uC21C");
109
+ injectString("ms", "Descending", "Menurun");
110
+ injectString("nb-NO", "Descending", "Synkende");
111
+ injectString("nl", "Descending", "Aflopend");
112
+ injectString("pl", "Descending", "Malej\u0105co");
113
+ injectString("pt-BR", "Descending", "Decrescente");
114
+ injectString("pt-PT", "Descending", "Descendente");
115
+ injectString("sk-SK", "Descending", "Zostupne");
116
+ injectString("sv", "Descending", "Fallande");
117
+ injectString("th", "Descending", "\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22");
118
+ injectString("tr", "Descending", "Azalan");
119
+ injectString("zh-Hans", "Descending", "\u964D\u5E8F");
120
+ injectString("zh-TW", "Descending", "\u905E\u6E1B");
121
+ injectString("ro-RO", "Descending", "Cobor\xE2re");
122
+ injectString("ar-SA", "Descending", "\u062A\u0646\u0627\u0632\u0644\u064A");
69
123
  injectString("cs", "Sort Options", "Sort Options");
70
124
  injectString("da-DK", "Sort Options", "Sorteringsmuligheder");
71
125
  injectString("de", "Sort Options", "Sort Options");
@@ -100,7 +154,6 @@ const useDrive_1 = require("../utils/theme/useDrive");
100
154
  const iconChevronDownSmall_1 = require("../icons/iconChevronDownSmall");
101
155
  const iconFilter3Asc_1 = require("../icons/iconFilter3Asc");
102
156
  const iconFilter3Desc_1 = require("../icons/iconFilter3Desc");
103
- const MENU_POSITION = "bottom-left";
104
157
  const BUTTON_TEXT_DEFAULT = "Sort by";
105
158
  var SortDirections;
106
159
  (function (SortDirections) {
@@ -157,7 +210,6 @@ const SortControl = ({
157
210
  onClick: () => onSortDirectionToggle(),
158
211
  disabled: disabled,
159
212
  title: translate("Change sort direction"),
160
- "aria-label": translate("Change sort direction"),
161
213
  children: [directionIcon ? sortDirection === SortDirections.Ascending ? (0, jsx_runtime_1.jsx)(iconFilter3Asc_1.IconFilter3Asc, {
162
214
  className: "zen-sort-container__sort-icon",
163
215
  size: isDrive ? "huge" : "large"
@@ -170,6 +222,9 @@ const SortControl = ({
170
222
  children: [buttonTextValue, ": "]
171
223
  }), (0, jsx_runtime_1.jsx)("span", {
172
224
  children: (items.find(item => item.id === sortBy) || items[0]).children
225
+ }), (0, jsx_runtime_1.jsxs)("span", {
226
+ className: "zen-visually-hidden",
227
+ children: [" ", sortDirection === SortDirections.Ascending ? translate("Ascending") : translate("Descending")]
173
228
  })]
174
229
  })]
175
230
  }), isSingleItem ? "" : (0, jsx_runtime_1.jsx)(popup_1.Popup, {
@@ -183,7 +238,7 @@ const SortControl = ({
183
238
  size: isDrive ? "huge" : "large"
184
239
  })
185
240
  }),
186
- alignment: MENU_POSITION,
241
+ alignment: "bottom-left",
187
242
  onOpenChange: isCurrentlyOpen => onOptionsToggle(isCurrentlyOpen),
188
243
  children: (0, jsx_runtime_1.jsx)(selectList_1.SelectList, {
189
244
  id: "sortControlSelectList",
@@ -197,4 +252,4 @@ const SortControl = ({
197
252
  });
198
253
  };
199
254
  exports.SortControl = SortControl;
200
- exports.TRANSLATIONS = ["Sort by", "Sort Options", "Change sort direction"];
255
+ exports.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;
@@ -27,7 +27,7 @@ const isChildElement = function (child, expectedType) {
27
27
  }
28
28
  return false;
29
29
  };
30
- const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, selectAll, turnOffSelectAll, activeId, gridRef, onCloseDetailPanel) => (0, react_1.useMemo)(() => {
30
+ const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, activeId, gridRef, onCloseDetailPanel) => (0, react_1.useMemo)(() => {
31
31
  let bulkActions = undefined;
32
32
  let tablePagination = undefined;
33
33
  let activePage = undefined;
@@ -42,7 +42,7 @@ const useTableChildren = (children, isMobile, selected, allSelected, clearSelect
42
42
  }
43
43
  if (isChildElement(child, tableBulkActions_1.TableBulkActions.displayName)) {
44
44
  const bulkActionButtons = child.props.children || [];
45
- bulkActions = ((0, jsx_runtime_1.jsx)(bulkActions_1.BulkActions, { gridType: isMobile ? deviceType_1.DeviceType.Mobile : deviceType_1.DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, onSelectAll: selectAll, turnOffSelectAll: turnOffSelectAll, children: bulkActionButtons }));
45
+ bulkActions = ((0, jsx_runtime_1.jsx)(bulkActions_1.BulkActions, { gridType: isMobile ? deviceType_1.DeviceType.Mobile : deviceType_1.DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, children: bulkActionButtons }));
46
46
  return;
47
47
  }
48
48
  if (isChildElement(child, tablePagination_1.TablePagination.displayName)) {
@@ -103,5 +103,5 @@ const useTableChildren = (children, isMobile, selected, allSelected, clearSelect
103
103
  detailPanel: detailPanel,
104
104
  other: other
105
105
  };
106
- }, [children, clearSelection, isMobile, selected, gridRef, allSelected, selectAll, turnOffSelectAll, activeId, onCloseDetailPanel]);
106
+ }, [children, clearSelection, isMobile, selected, gridRef, allSelected, activeId, onCloseDetailPanel]);
107
107
  exports.useTableChildren = useTableChildren;