@geotab/zenith 3.16.0 → 3.17.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/README.md +67 -1
  2. package/README.md.baseline +1 -0
  3. package/dist/absolute/absolute.js +5 -1
  4. package/dist/button/button.d.ts +2 -1
  5. package/dist/button/button.js +22 -5
  6. package/dist/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
  7. package/dist/checkboxListWithAction/checkboxListWithAction.js +1 -1
  8. package/dist/commonHelpers/ShowMoreCell.d.ts +5 -0
  9. package/dist/commonHelpers/ShowMoreCell.js +66 -0
  10. package/dist/commonHelpers/getAriaAttributes.js +6 -9
  11. package/dist/commonHelpers/getNonAriaProps.d.ts +11 -0
  12. package/dist/commonHelpers/getNonAriaProps.js +19 -0
  13. package/dist/commonHelpers/hooks/useScroll.d.ts +1 -1
  14. package/dist/commonHelpers/hooks/useScroll.js +6 -6
  15. package/dist/commonHelpers/isAriaProp.d.ts +9 -0
  16. package/dist/commonHelpers/isAriaProp.js +13 -0
  17. package/dist/commonHelpers/showMoreRow.d.ts +28 -0
  18. package/dist/commonHelpers/showMoreRow.js +29 -0
  19. package/dist/commonHelpers/tabsKeyboard.d.ts +1 -1
  20. package/dist/commonHelpers/tabsKeyboard.js +15 -1
  21. package/dist/commonStyles/colors/colors.less +18 -0
  22. package/dist/dataFeed/dataFeedColumnsItems.js +3 -1
  23. package/dist/dataGrid/columns/checkboxColumn/checkboxCell.d.ts +2 -1
  24. package/dist/dataGrid/columns/checkboxColumn/checkboxCell.js +1 -1
  25. package/dist/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.d.ts +4 -2
  26. package/dist/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.js +10 -1
  27. package/dist/dataGrid/dataGrid.d.ts +5 -1
  28. package/dist/dataGrid/dataGrid.js +39 -2
  29. package/dist/dataGrid/lazyLoadingEnd/lazyLoadingEnd.d.ts +3 -0
  30. package/dist/dataGrid/lazyLoadingEnd/lazyLoadingEnd.js +54 -0
  31. package/dist/dataGrid/row/row.js +20 -2
  32. package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -1
  33. package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +39 -4
  34. package/dist/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
  35. package/dist/dropdown/dropdownTrigger.d.ts +1 -1
  36. package/dist/dropdownRaw/dropdownHelper.d.ts +12 -0
  37. package/dist/dropdownRaw/dropdownHelper.js +32 -11
  38. package/dist/dropdownRaw/dropdownRaw.js +36 -8
  39. package/dist/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
  40. package/dist/dropdownRaw/dropdownSearchableTrigger.js +13 -6
  41. package/dist/dropdownRaw/dropdownTrigger.d.ts +2 -1
  42. package/dist/dropdownRaw/dropdownTrigger.js +2 -2
  43. package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
  44. package/dist/dropdownRaw/stateReducer/stateReducer.js +5 -2
  45. package/dist/dropdownRaw/types.d.ts +36 -0
  46. package/dist/filterButton/filterButton.d.ts +1 -1
  47. package/dist/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
  48. package/dist/formLayout/utils/applyLayoutPosition/applyLayoutPosition.d.ts +2 -1
  49. package/dist/formLayout/utils/applyLayoutPosition/applyLayoutPosition.js +37 -90
  50. package/dist/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
  51. package/dist/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
  52. package/dist/header/headerButton.d.ts +3 -1
  53. package/dist/header/headerButton.js +4 -2
  54. package/dist/header/headerMenu.d.ts +2 -0
  55. package/dist/header/headerMenu.js +1 -1
  56. package/dist/index.css +319 -68
  57. package/dist/index.d.ts +3 -1
  58. package/dist/index.js +9 -3
  59. package/dist/menu/components/menuButton.d.ts +3 -1
  60. package/dist/menu/components/menuButton.js +66 -47
  61. package/dist/menu/components/menuItem.js +4 -4
  62. package/dist/miniTabs/miniTabs.js +4 -2
  63. package/dist/pageHeader/pageHeaderButton.d.ts +1 -1
  64. package/dist/pageHeader/pageHeaderButton.js +4 -2
  65. package/dist/pagination/pagination.d.ts +19 -4
  66. package/dist/pagination/pagination.js +21 -1
  67. package/dist/pagination/paginationText/paginationText.d.ts +7 -1
  68. package/dist/pagination/paginationText/paginationText.js +6 -3
  69. package/dist/pillExpandable/pillContent.d.ts +3 -2
  70. package/dist/pillExpandable/pillContent.js +2 -2
  71. package/dist/pillExpandable/pillExpandable.js +20 -5
  72. package/dist/pillExpandable/pillExpandablePopoverContent.d.ts +3 -2
  73. package/dist/pillExpandable/pillExpandablePopoverContent.js +1 -1
  74. package/dist/pillExpandable/pillExpandableSimple.d.ts +3 -1
  75. package/dist/pillExpandable/pillExpandableSimple.js +19 -9
  76. package/dist/selectList/selectList.js +1 -0
  77. package/dist/selectList/selectListItem.d.ts +10 -1
  78. package/dist/selectList/selectListItem.js +12 -9
  79. package/dist/table/children/tablePagination.d.ts +1 -1
  80. package/dist/table/children/useTableChildren.d.ts +4 -2
  81. package/dist/table/children/useTableChildren.js +64 -16
  82. package/dist/table/nested/nestedData.d.ts +29 -1
  83. package/dist/table/nested/nestedData.js +45 -4
  84. package/dist/table/nested/useNestedRows.js +18 -22
  85. package/dist/table/nested/useShowMore.d.ts +41 -0
  86. package/dist/table/nested/useShowMore.js +56 -0
  87. package/dist/table/selectable/interfaces.d.ts +17 -0
  88. package/dist/table/selectable/useDragSelection.d.ts +10 -0
  89. package/dist/table/selectable/useDragSelection.js +145 -0
  90. package/dist/table/selectable/useSelectableRows.d.ts +5 -2
  91. package/dist/table/selectable/useSelectableRows.js +131 -36
  92. package/dist/table/selectable/utils/calculateSelectionState.d.ts +1 -1
  93. package/dist/table/selectable/utils/calculateSelectionState.js +43 -7
  94. package/dist/table/selectable/utils/checkRow.js +4 -2
  95. package/dist/table/selectable/utils/getCurrentPageSelection.js +9 -5
  96. package/dist/table/selectable/utils/getDragSelectionRows.d.ts +15 -0
  97. package/dist/table/selectable/utils/getDragSelectionRows.js +28 -0
  98. package/dist/table/selectable/utils/getRangeIds.d.ts +2 -0
  99. package/dist/table/selectable/utils/getRangeIds.js +21 -0
  100. package/dist/table/selectable/utils/isRowChecked.d.ts +1 -1
  101. package/dist/table/selectable/utils/isRowChecked.js +40 -7
  102. package/dist/table/table.d.ts +1 -2
  103. package/dist/table/table.js +58 -31
  104. package/dist/tabs/tabs.d.ts +1 -0
  105. package/dist/tabs/tabs.js +50 -17
  106. package/dist/textInputRaw/textInputRaw.js +3 -2
  107. package/dist/tooltip/tooltip.d.ts +2 -0
  108. package/dist/tooltip/tooltip.js +19 -7
  109. package/dist/utils/localization/translations/ar-001.json +1 -0
  110. package/dist/utils/localization/translations/bg-BG.json +1 -0
  111. package/dist/utils/localization/translations/cs.json +1 -0
  112. package/dist/utils/localization/translations/da-DK.json +1 -0
  113. package/dist/utils/localization/translations/de.json +1 -0
  114. package/dist/utils/localization/translations/el-GR.json +1 -0
  115. package/dist/utils/localization/translations/en.json +4 -0
  116. package/dist/utils/localization/translations/es.json +1 -0
  117. package/dist/utils/localization/translations/et-EE.json +1 -0
  118. package/dist/utils/localization/translations/fi-FI.json +1 -0
  119. package/dist/utils/localization/translations/fr-FR.json +1 -0
  120. package/dist/utils/localization/translations/fr.json +1 -0
  121. package/dist/utils/localization/translations/hu-HU.json +1 -0
  122. package/dist/utils/localization/translations/id.json +1 -0
  123. package/dist/utils/localization/translations/it.json +1 -0
  124. package/dist/utils/localization/translations/ja.json +1 -0
  125. package/dist/utils/localization/translations/ka-GE.json +1 -0
  126. package/dist/utils/localization/translations/ko-KR.json +1 -0
  127. package/dist/utils/localization/translations/lt-LT.json +1 -0
  128. package/dist/utils/localization/translations/lv-LV.json +1 -0
  129. package/dist/utils/localization/translations/ms.json +1 -0
  130. package/dist/utils/localization/translations/nb-NO.json +1 -0
  131. package/dist/utils/localization/translations/nl.json +1 -0
  132. package/dist/utils/localization/translations/pl.json +1 -0
  133. package/dist/utils/localization/translations/pt-BR.json +1 -0
  134. package/dist/utils/localization/translations/pt-PT.json +1 -0
  135. package/dist/utils/localization/translations/ro-RO.json +1 -0
  136. package/dist/utils/localization/translations/sk-SK.json +1 -0
  137. package/dist/utils/localization/translations/sv.json +1 -0
  138. package/dist/utils/localization/translations/th.json +1 -0
  139. package/dist/utils/localization/translations/tr.json +1 -0
  140. package/dist/utils/localization/translations/zh-Hans.json +1 -0
  141. package/dist/utils/localization/translations/zh-TW.json +1 -0
  142. package/dist/waiting/waiting.js +97 -1
  143. package/esm/absolute/absolute.js +5 -1
  144. package/esm/button/button.d.ts +2 -1
  145. package/esm/button/button.js +22 -5
  146. package/esm/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
  147. package/esm/checkboxListWithAction/checkboxListWithAction.js +1 -1
  148. package/esm/commonHelpers/ShowMoreCell.d.ts +5 -0
  149. package/esm/commonHelpers/ShowMoreCell.js +57 -0
  150. package/esm/commonHelpers/getAriaAttributes.js +6 -9
  151. package/esm/commonHelpers/getNonAriaProps.d.ts +11 -0
  152. package/esm/commonHelpers/getNonAriaProps.js +15 -0
  153. package/esm/commonHelpers/hooks/useScroll.d.ts +1 -1
  154. package/esm/commonHelpers/hooks/useScroll.js +6 -6
  155. package/esm/commonHelpers/isAriaProp.d.ts +9 -0
  156. package/esm/commonHelpers/isAriaProp.js +9 -0
  157. package/esm/commonHelpers/showMoreRow.d.ts +28 -0
  158. package/esm/commonHelpers/showMoreRow.js +22 -0
  159. package/esm/commonHelpers/tabsKeyboard.d.ts +1 -1
  160. package/esm/commonHelpers/tabsKeyboard.js +15 -1
  161. package/esm/commonStyles/colors/colorsConstant.js +11 -11
  162. package/esm/dataFeed/dataFeedColumnsItems.js +3 -1
  163. package/esm/dataGrid/columns/checkboxColumn/checkboxCell.d.ts +2 -1
  164. package/esm/dataGrid/columns/checkboxColumn/checkboxCell.js +1 -1
  165. package/esm/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.d.ts +4 -2
  166. package/esm/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.js +10 -1
  167. package/esm/dataGrid/dataGrid.d.ts +5 -1
  168. package/esm/dataGrid/dataGrid.js +38 -2
  169. package/esm/dataGrid/lazyLoadingEnd/lazyLoadingEnd.d.ts +3 -0
  170. package/esm/dataGrid/lazyLoadingEnd/lazyLoadingEnd.js +45 -0
  171. package/esm/dataGrid/row/row.js +20 -2
  172. package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -1
  173. package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +39 -4
  174. package/esm/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
  175. package/esm/dropdown/dropdownTrigger.d.ts +1 -1
  176. package/esm/dropdownRaw/dropdownHelper.d.ts +12 -0
  177. package/esm/dropdownRaw/dropdownHelper.js +30 -10
  178. package/esm/dropdownRaw/dropdownRaw.js +37 -9
  179. package/esm/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
  180. package/esm/dropdownRaw/dropdownSearchableTrigger.js +13 -6
  181. package/esm/dropdownRaw/dropdownTrigger.d.ts +2 -1
  182. package/esm/dropdownRaw/dropdownTrigger.js +2 -2
  183. package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
  184. package/esm/dropdownRaw/stateReducer/stateReducer.js +5 -2
  185. package/esm/dropdownRaw/types.d.ts +36 -0
  186. package/esm/filterButton/filterButton.d.ts +1 -1
  187. package/esm/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
  188. package/esm/formLayout/utils/applyLayoutPosition/applyLayoutPosition.d.ts +2 -1
  189. package/esm/formLayout/utils/applyLayoutPosition/applyLayoutPosition.js +37 -90
  190. package/esm/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
  191. package/esm/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
  192. package/esm/header/headerButton.d.ts +3 -1
  193. package/esm/header/headerButton.js +4 -2
  194. package/esm/header/headerMenu.d.ts +2 -0
  195. package/esm/header/headerMenu.js +1 -1
  196. package/esm/index.d.ts +3 -1
  197. package/esm/index.js +3 -1
  198. package/esm/menu/components/menuButton.d.ts +3 -1
  199. package/esm/menu/components/menuButton.js +66 -47
  200. package/esm/menu/components/menuItem.js +4 -4
  201. package/esm/miniTabs/miniTabs.js +4 -2
  202. package/esm/pageHeader/pageHeaderButton.d.ts +1 -1
  203. package/esm/pageHeader/pageHeaderButton.js +4 -2
  204. package/esm/pagination/pagination.d.ts +19 -4
  205. package/esm/pagination/pagination.js +21 -1
  206. package/esm/pagination/paginationText/paginationText.d.ts +7 -1
  207. package/esm/pagination/paginationText/paginationText.js +6 -3
  208. package/esm/pillExpandable/pillContent.d.ts +3 -2
  209. package/esm/pillExpandable/pillContent.js +2 -2
  210. package/esm/pillExpandable/pillExpandable.js +20 -5
  211. package/esm/pillExpandable/pillExpandablePopoverContent.d.ts +3 -2
  212. package/esm/pillExpandable/pillExpandablePopoverContent.js +1 -1
  213. package/esm/pillExpandable/pillExpandableSimple.d.ts +3 -1
  214. package/esm/pillExpandable/pillExpandableSimple.js +20 -10
  215. package/esm/selectList/selectList.js +1 -0
  216. package/esm/selectList/selectListItem.d.ts +10 -1
  217. package/esm/selectList/selectListItem.js +12 -9
  218. package/esm/table/children/tablePagination.d.ts +1 -1
  219. package/esm/table/children/useTableChildren.d.ts +4 -2
  220. package/esm/table/children/useTableChildren.js +64 -16
  221. package/esm/table/nested/nestedData.d.ts +29 -1
  222. package/esm/table/nested/nestedData.js +44 -3
  223. package/esm/table/nested/useNestedRows.js +18 -22
  224. package/esm/table/nested/useShowMore.d.ts +41 -0
  225. package/esm/table/nested/useShowMore.js +52 -0
  226. package/esm/table/selectable/interfaces.d.ts +17 -0
  227. package/esm/table/selectable/useDragSelection.d.ts +10 -0
  228. package/esm/table/selectable/useDragSelection.js +141 -0
  229. package/esm/table/selectable/useSelectableRows.d.ts +5 -2
  230. package/esm/table/selectable/useSelectableRows.js +129 -35
  231. package/esm/table/selectable/utils/calculateSelectionState.d.ts +1 -1
  232. package/esm/table/selectable/utils/calculateSelectionState.js +43 -7
  233. package/esm/table/selectable/utils/checkRow.js +4 -2
  234. package/esm/table/selectable/utils/getCurrentPageSelection.js +9 -5
  235. package/esm/table/selectable/utils/getDragSelectionRows.d.ts +15 -0
  236. package/esm/table/selectable/utils/getDragSelectionRows.js +24 -0
  237. package/esm/table/selectable/utils/getRangeIds.d.ts +2 -0
  238. package/esm/table/selectable/utils/getRangeIds.js +17 -0
  239. package/esm/table/selectable/utils/isRowChecked.d.ts +1 -1
  240. package/esm/table/selectable/utils/isRowChecked.js +40 -7
  241. package/esm/table/table.d.ts +1 -2
  242. package/esm/table/table.js +43 -16
  243. package/esm/tabs/tabs.d.ts +1 -0
  244. package/esm/tabs/tabs.js +50 -17
  245. package/esm/textInputRaw/textInputRaw.js +3 -2
  246. package/esm/tooltip/tooltip.d.ts +2 -0
  247. package/esm/tooltip/tooltip.js +19 -7
  248. package/esm/utils/localization/translations/ar-001.json +1 -0
  249. package/esm/utils/localization/translations/bg-BG.json +1 -0
  250. package/esm/utils/localization/translations/cs.json +1 -0
  251. package/esm/utils/localization/translations/da-DK.json +1 -0
  252. package/esm/utils/localization/translations/de.json +1 -0
  253. package/esm/utils/localization/translations/el-GR.json +1 -0
  254. package/esm/utils/localization/translations/en.json +4 -0
  255. package/esm/utils/localization/translations/es.json +1 -0
  256. package/esm/utils/localization/translations/et-EE.json +1 -0
  257. package/esm/utils/localization/translations/fi-FI.json +1 -0
  258. package/esm/utils/localization/translations/fr-FR.json +1 -0
  259. package/esm/utils/localization/translations/fr.json +1 -0
  260. package/esm/utils/localization/translations/hu-HU.json +1 -0
  261. package/esm/utils/localization/translations/id.json +1 -0
  262. package/esm/utils/localization/translations/it.json +1 -0
  263. package/esm/utils/localization/translations/ja.json +1 -0
  264. package/esm/utils/localization/translations/ka-GE.json +1 -0
  265. package/esm/utils/localization/translations/ko-KR.json +1 -0
  266. package/esm/utils/localization/translations/lt-LT.json +1 -0
  267. package/esm/utils/localization/translations/lv-LV.json +1 -0
  268. package/esm/utils/localization/translations/ms.json +1 -0
  269. package/esm/utils/localization/translations/nb-NO.json +1 -0
  270. package/esm/utils/localization/translations/nl.json +1 -0
  271. package/esm/utils/localization/translations/pl.json +1 -0
  272. package/esm/utils/localization/translations/pt-BR.json +1 -0
  273. package/esm/utils/localization/translations/pt-PT.json +1 -0
  274. package/esm/utils/localization/translations/ro-RO.json +1 -0
  275. package/esm/utils/localization/translations/sk-SK.json +1 -0
  276. package/esm/utils/localization/translations/sv.json +1 -0
  277. package/esm/utils/localization/translations/th.json +1 -0
  278. package/esm/utils/localization/translations/tr.json +1 -0
  279. package/esm/utils/localization/translations/zh-Hans.json +1 -0
  280. package/esm/utils/localization/translations/zh-TW.json +1 -0
  281. package/esm/waiting/waiting.js +98 -2
  282. package/package.json +15 -3
@@ -4,108 +4,55 @@ import { Banner } from "../../../banner/banner";
4
4
  import { FormLayoutTitle } from "../../components/formLayoutTitle";
5
5
  import { FormLayoutColumnTitle } from "../../components/columnTitle/formLayoutColumnTitle";
6
6
  const STATIC_COMPONENTS = [FormStepper, FormStepperButtons, Banner, FormLayoutTitle, FormLayoutColumnTitle];
7
- const transform = components => {
8
- const state = {};
9
- // eslint-disable-next-line
10
- // @ts-ignore
11
- const movableComponents = components.filter((child) => !STATIC_COMPONENTS.includes(child.type));
12
- // 1. Initialize state
13
- components.forEach((child, index) => {
14
- // eslint-disable-next-line
15
- // @ts-ignore
16
- if (STATIC_COMPONENTS.includes(child.type)) {
17
- state[index] = {
18
- value: child,
19
- realPos: index,
20
- oldPos: null,
21
- newPos: null,
22
- newRealPos: index
23
- };
7
+ const isStaticComponent = (child) => STATIC_COMPONENTS.includes(child.type);
8
+ const getLayoutPosition = (child) => child.props.layoutPosition;
9
+ const findNextFreeIndex = (fields, startIndex) => {
10
+ for (let offset = 0; offset < fields.length; offset++) {
11
+ const candidateIndex = (startIndex + offset) % fields.length;
12
+ if (fields[candidateIndex] === null) {
13
+ return candidateIndex;
14
+ }
15
+ }
16
+ return -1;
17
+ };
18
+ const clampLayoutPosition = (layoutPosition, maxPosition) => Math.max(0, Math.min(Math.trunc(layoutPosition), maxPosition));
19
+ const transform = (components) => {
20
+ const movableComponents = components.filter(child => !isStaticComponent(child));
21
+ const positionedComponents = new Array(movableComponents.length).fill(null);
22
+ movableComponents.forEach(child => {
23
+ const layoutPosition = getLayoutPosition(child);
24
+ if (layoutPosition === undefined || !Number.isFinite(layoutPosition)) {
24
25
  return;
25
26
  }
26
- // eslint-disable-next-line
27
- // @ts-ignore
28
- const layoutPosition = child.props.layoutPosition;
29
- const newPositions = Object.values(state).map(field => field.newPos);
30
- let newPos;
31
- if (layoutPosition !== undefined) {
32
- newPos = layoutPosition < 0 ? 0 : layoutPosition > movableComponents.length - 1 ? movableComponents.length - 1 : layoutPosition;
33
- // eslint-disable-next-line
34
- if (newPositions.indexOf(newPos) !== -1) {
35
- if (layoutPosition >= movableComponents.length - 1) {
36
- newPos = 0;
37
- }
38
- // eslint-disable-next-line
39
- while (newPositions.indexOf(newPos) !== -1) {
40
- newPos++;
41
- }
42
- }
27
+ const clampedLayoutPosition = clampLayoutPosition(layoutPosition, movableComponents.length - 1);
28
+ const targetIndex = findNextFreeIndex(positionedComponents, clampedLayoutPosition);
29
+ if (targetIndex !== -1) {
30
+ positionedComponents[targetIndex] = child;
43
31
  }
44
- else {
45
- newPos = null;
46
- }
47
- state[index] = {
48
- value: child,
49
- realPos: index,
50
- oldPos: movableComponents.indexOf(child),
51
- newPos: newPos,
52
- newRealPos: null
53
- };
54
32
  });
55
- // 2. Adjust positions
56
- components
57
- .sort((a, b) => a.props.layoutPosition - b.props.layoutPosition)
58
- .forEach((child, index) => {
59
- // eslint-disable-next-line
60
- // @ts-ignore
61
- if (STATIC_COMPONENTS.includes(child.type)) {
33
+ const placedComponents = new Set(positionedComponents);
34
+ movableComponents.forEach(child => {
35
+ if (placedComponents.has(child)) {
62
36
  return;
63
37
  }
64
- if (state[index].newPos !== null) {
65
- return;
38
+ const targetIndex = findNextFreeIndex(positionedComponents, 0);
39
+ if (targetIndex !== -1) {
40
+ positionedComponents[targetIndex] = child;
66
41
  }
67
- // eslint-disable-next-line
68
- // @ts-ignore
69
- const layoutPosition = child.props.layoutPosition;
70
- const newPositions = Object.values(state)
71
- .map(field => field.newPos)
72
- .filter(pos => pos !== null);
73
- let newPos = 0;
74
- if (newPositions.indexOf(newPos) !== -1) {
75
- if (layoutPosition >= movableComponents.length - 1) {
76
- newPos = 0;
77
- }
78
- while (newPositions.indexOf(newPos) !== -1) {
79
- newPos++;
80
- }
81
- }
82
- state[index] = {
83
- value: child,
84
- realPos: index,
85
- oldPos: movableComponents.indexOf(child),
86
- newPos: newPos,
87
- newRealPos: null
88
- };
89
42
  });
90
- // 3. Update newRealPos
91
- components.forEach((child) => {
92
- // eslint-disable-next-line
93
- // @ts-ignore
94
- if (STATIC_COMPONENTS.includes(child.type)) {
43
+ const reorderedMovableComponents = positionedComponents.filter((child) => child !== null);
44
+ const reorderedComponents = [...components];
45
+ let movableIndex = 0;
46
+ components.forEach((child, index) => {
47
+ if (isStaticComponent(child)) {
48
+ reorderedComponents[index] = child;
95
49
  return;
96
50
  }
97
- const index = components.indexOf(child);
98
- const newPos = state[index].newPos;
99
- const withOldPos = Object.values(state).find(field => field.oldPos === newPos);
100
- if (withOldPos) {
101
- state[index].newRealPos = withOldPos.realPos;
102
- }
51
+ reorderedComponents[index] = reorderedMovableComponents[movableIndex];
52
+ movableIndex++;
103
53
  });
104
- return Object.values(state)
105
- .sort((a, b) => a.newRealPos - b.newRealPos)
106
- .map(el => el.value);
54
+ return reorderedComponents;
107
55
  };
108
- // TODO: test with titles
109
56
  export const applyLayoutPosition = (components, result) => {
110
57
  const state = transform(components);
111
58
  result.length = 0;
@@ -5,7 +5,7 @@ import { IMenuItem } from "../../../menu/components/menuItem";
5
5
  export interface ICustomContent {
6
6
  [key: string]: React.ReactElement<PropsWithChildren> | undefined;
7
7
  }
8
- export interface IHeaderCustomMenuComponent extends Pick<IMenuItem, "id" | "name" | "disabled" | "link" | "target" | "rel" | "icon"> {
8
+ export interface IHeaderCustomMenuComponent extends Pick<IMenuItem, "id" | "name" | "disabled" | "link" | "target" | "rel" | "icon" | "iconOpen" | "destructive"> {
9
9
  }
10
10
  export interface IHeaderCustomContent {
11
11
  content: ICustomContent | null;
@@ -100,7 +100,9 @@ export const PageToolbarCollapsedItemsControl = ({
100
100
  link: child.props.link,
101
101
  target: child.props.target,
102
102
  rel: child.props.rel,
103
- icon: child.props.icon
103
+ icon: child.props.icon,
104
+ iconOpen: child.props.iconOpen,
105
+ destructive: child.props.destructive
104
106
  });
105
107
  items.push(el);
106
108
  }
@@ -113,7 +115,9 @@ export const PageToolbarCollapsedItemsControl = ({
113
115
  link: child.props.link,
114
116
  target: child.props.target,
115
117
  rel: child.props.rel,
116
- icon: child.props.icon
118
+ icon: child.props.icon,
119
+ iconOpen: child.props.iconOpen,
120
+ destructive: child.props.destructive
117
121
  }, child.props.children);
118
122
  items.push(el);
119
123
  }
@@ -7,6 +7,8 @@ export interface IHeaderButton extends Omit<IButton, "onClick"> {
7
7
  important?: boolean;
8
8
  inContextMenu?: boolean;
9
9
  icon?: React.FC<IIcon>;
10
+ iconOpen?: boolean;
11
+ destructive?: boolean;
10
12
  iconPosition?: TButtonIconPosition;
11
13
  iconClasses?: string;
12
14
  iconSize?: TSvgIconSize;
@@ -14,6 +16,6 @@ export interface IHeaderButton extends Omit<IButton, "onClick"> {
14
16
  }
15
17
  export declare const HeaderButtonDisplayName = "HeaderButton";
16
18
  export declare const HeaderButton: {
17
- ({ id, children, icon, iconPosition, className, important, onClick, inContextMenu, ...restProps }: IHeaderButton): import("react/jsx-runtime").JSX.Element;
19
+ ({ id, children, icon, iconOpen, destructive, iconPosition, className, important, onClick, inContextMenu, disabled, focusableWhenDisabled, ...restProps }: IHeaderButton): import("react/jsx-runtime").JSX.Element;
18
20
  displayName: string;
19
21
  };
@@ -15,9 +15,11 @@ import { ButtonIconPosition, TextIconButton } from "../textIconButton/textIconBu
15
15
  import { classNames } from "../commonHelpers/classNames/classNames";
16
16
  export const HeaderButtonDisplayName = "HeaderButton";
17
17
  export const HeaderButton = (_a) => {
18
- var { id, children, icon, iconPosition = ButtonIconPosition.Start, className = "", important, onClick, inContextMenu } = _a, restProps = __rest(_a, ["id", "children", "icon", "iconPosition", "className", "important", "onClick", "inContextMenu"]);
18
+ var { id, children, icon, iconOpen, destructive, iconPosition = ButtonIconPosition.Start, className = "", important, onClick, inContextMenu, disabled, focusableWhenDisabled } = _a, restProps = __rest(_a, ["id", "children", "icon", "iconOpen", "destructive", "iconPosition", "className", "important", "onClick", "inContextMenu", "disabled", "focusableWhenDisabled"]);
19
19
  const fullClassName = classNames(["zen-header-button", className]);
20
- const props = Object.assign(Object.assign({}, restProps), { "data-important": important ? "1" : "0" });
20
+ const props = Object.assign(Object.assign({}, restProps), { disabled, "data-important": important ? "1" : "0",
21
+ // Defaults on when disabled; pass `focusableWhenDisabled={false}` to opt back into native `disabled`.
22
+ focusableWhenDisabled: focusableWhenDisabled !== null && focusableWhenDisabled !== void 0 ? focusableWhenDisabled : Boolean(disabled) });
21
23
  return icon ? (_jsx(TextIconButton, Object.assign({ id: id, icon: icon, iconPosition: iconPosition, className: fullClassName, onClick: onClick ? e => onClick(id, e) : undefined }, props, { children: children }))) : (_jsx(Button, Object.assign({ id: id, className: fullClassName, onClick: onClick ? e => onClick(id, e) : undefined }, props, { children: children })));
22
24
  };
23
25
  HeaderButton.displayName = HeaderButtonDisplayName;
@@ -10,6 +10,8 @@ export interface IHeaderMenu extends Omit<IButton, "onClick"> {
10
10
  important?: boolean;
11
11
  inContextMenu?: boolean;
12
12
  icon?: FC<IIcon>;
13
+ iconOpen?: boolean;
14
+ destructive?: boolean;
13
15
  iconSize?: TSvgIconSize;
14
16
  alignment?: TAlignment;
15
17
  onlyIcon?: boolean;
@@ -21,7 +21,7 @@ import { useDrive } from "../utils/theme/useDrive";
21
21
  import { useDriveClassName } from "../utils/theme/useDriveClassName";
22
22
  export const HeaderMenuDisplayName = "HeaderMenu";
23
23
  export const HeaderMenu = (_a) => {
24
- var { name, children, icon, iconSize = "large", className = "", important, alignment = "bottom-end", inContextMenu, onlyIcon } = _a, restProps = __rest(_a, ["name", "children", "icon", "iconSize", "className", "important", "alignment", "inContextMenu", "onlyIcon"]);
24
+ var { name, children, icon, iconOpen, destructive, iconSize = "large", className = "", important, alignment = "bottom-end", inContextMenu, onlyIcon } = _a, restProps = __rest(_a, ["name", "children", "icon", "iconOpen", "destructive", "iconSize", "className", "important", "alignment", "inContextMenu", "onlyIcon"]);
25
25
  const isMobile = useMobile();
26
26
  const isDrive = useDrive();
27
27
  const driveClassName = useDriveClassName("zen-header-button-with-dropdown");
package/esm/index.d.ts CHANGED
@@ -736,6 +736,7 @@ export { PageLayout } from "./pageLayout/pageLayout";
736
736
  export { type IPagination, Pagination } from "./pagination/pagination";
737
737
  export { PaginationType } from "./pagination/paginationType";
738
738
  export { Pill } from "./pill/pill";
739
+ export { DEFAULT_MAX_PILLS, type IPillData, type IPillBox, PillBox } from "./pillBox/pillBox";
739
740
  export { type IPillExpandableAction, type IBaseData, type IPromisedBaseData, type TPopoverSize, type IPillExpandable, PillExpandable } from "./pillExpandable/pillExpandable";
740
741
  export { type IPopup, Popup } from "./popup/popup";
741
742
  export { type IPrimaryIcon, PrimaryIcon } from "./primaryIcon/primaryIcon";
@@ -762,8 +763,9 @@ export { type ISummaryTileBar, SummaryTileBar, SummaryTileBarDisplayName } from
762
763
  export { type ITab, type ITabBar, TabBar } from "./tabBar/tabBar";
763
764
  export { type ITabBarContent, TabBarContent } from "./tabBar/tabBarContent";
764
765
  export { type ITableDetailPanel } from "./table/children/tableDetailPanel";
765
- export { NestedData } from "./table/nested/nestedData";
766
+ export { DEFAULT_SHOW_MORE_CAP, type IShowMoreOptions, NestedData } from "./table/nested/nestedData";
766
767
  export { useNestedRows } from "./table/nested/useNestedRows";
768
+ export { type IUseShowMoreConfig, useShowMore } from "./table/nested/useShowMore";
767
769
  export { type IListColumn, type TFeedResult, type IFeedExpandable, type ITable, type IListColumnWrapper, Table, getEmptySelection, ColumnSortDirection, getSortableValue, ActionsColumn, MainColumn, CheckboxColumn, ActionLinkColumn } from "./table/table";
768
770
  export { type ITabElement, type ITabs, TabsDisplayName, Tabs } from "./tabs/tabs";
769
771
  export { type TTagColor, type ITag } from "./tag/tag";
package/esm/index.js CHANGED
@@ -722,6 +722,7 @@ export { PageLayout } from "./pageLayout/pageLayout";
722
722
  export { Pagination } from "./pagination/pagination";
723
723
  export { PaginationType } from "./pagination/paginationType";
724
724
  export { Pill } from "./pill/pill";
725
+ export { DEFAULT_MAX_PILLS, PillBox } from "./pillBox/pillBox";
725
726
  export { PillExpandable } from "./pillExpandable/pillExpandable";
726
727
  export { Popup } from "./popup/popup";
727
728
  export { PrimaryIcon } from "./primaryIcon/primaryIcon";
@@ -747,8 +748,9 @@ export { getTypeClassName } from "./summaryTile/utils/getTypeClassName";
747
748
  export { SummaryTileBar, SummaryTileBarDisplayName } from "./summaryTileBar/summaryTileBar";
748
749
  export { TabBar } from "./tabBar/tabBar";
749
750
  export { TabBarContent } from "./tabBar/tabBarContent";
750
- export { NestedData } from "./table/nested/nestedData";
751
+ export { DEFAULT_SHOW_MORE_CAP, NestedData } from "./table/nested/nestedData";
751
752
  export { useNestedRows } from "./table/nested/useNestedRows";
753
+ export { useShowMore } from "./table/nested/useShowMore";
752
754
  export { Table, getEmptySelection, ColumnSortDirection, getSortableValue, ActionsColumn, MainColumn, CheckboxColumn, ActionLinkColumn } from "./table/table";
753
755
  export { TabsDisplayName, Tabs } from "./tabs/tabs";
754
756
  export { ButtonIconPosition, TextIconButton } from "./textIconButton/textIconButton";
@@ -9,6 +9,8 @@ interface IMenuButtonInternal {
9
9
  export interface IMenuButton extends IZenIdComponentProps {
10
10
  name: string;
11
11
  icon?: FC<IIcon>;
12
+ iconOpen?: boolean;
13
+ destructive?: boolean;
12
14
  disabled?: boolean;
13
15
  link?: string;
14
16
  target?: string;
@@ -18,5 +20,5 @@ export interface IMenuButton extends IZenIdComponentProps {
18
20
  ref?: RefObject<HTMLButtonElement | null>;
19
21
  dataAnalyticsId?: string;
20
22
  }
21
- export declare const MenuButton: ({ id, onClick, hasChildren, disabled, icon, name, link, target, rel, className, active, ref, dataAnalyticsId }: IMenuButton & IMenuButtonInternal) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const MenuButton: ({ id, onClick, hasChildren, disabled, icon, iconOpen, destructive, name, link, target, rel, className, active, ref, dataAnalyticsId }: IMenuButton & IMenuButtonInternal) => import("react/jsx-runtime").JSX.Element;
22
24
  export {};
@@ -3,62 +3,81 @@ import { createElement, useCallback, useMemo } from "react";
3
3
  import { classNames } from "../../commonHelpers/classNames/classNames";
4
4
  import { IconChevronRight } from "../../icons/iconChevronRight";
5
5
  import { IconChevronLeft } from "../../icons/iconChevronLeft";
6
+ import { IconOpen } from "../../icons/iconOpen";
6
7
  import { useDirectionalIcon } from "../../utils/localization/useDirectionalIcon";
7
8
  import { useDriveClassName } from "../../utils/theme/useDriveClassName";
8
9
  import { useDrive } from "../../utils/theme/useDrive";
9
10
  import { getMenuButtonState } from "../utils/getMenuButtonState";
10
11
  import { isSafeHref } from "../utils/isSafeHref";
11
12
  import { getSafeRel } from "../utils/getSafeRel";
12
- export const MenuButton = ({ id, onClick, hasChildren, disabled, icon, name, link, target, rel, className = "", active = null, ref, dataAnalyticsId }) => {
13
+ // Templates below drop native `disabled` to stay focusable/hoverable; this guard blocks activation instead.
14
+ const handleDisabledGuardedClick = (e, disabled, id, onClick) => {
15
+ if (disabled) {
16
+ e.preventDefault();
17
+ e.stopPropagation();
18
+ return;
19
+ }
20
+ onClick === null || onClick === void 0 ? void 0 : onClick(id, e);
21
+ };
22
+ // Skip Space-to-activate when disabled, so it doesn't flash `--active` or self-click via `linkEl.click()`.
23
+ const createDisabledGuardedLinkKeyEvents = (disabled) => ({
24
+ onKeyDown: (e) => {
25
+ if (disabled || e.key !== " ") {
26
+ return;
27
+ }
28
+ e.preventDefault();
29
+ const linkEl = e.target;
30
+ linkEl.dataset.spaceDown = "1";
31
+ linkEl.classList.add("zen-menu-button__action--active");
32
+ },
33
+ onKeyUp: (e) => {
34
+ if (disabled || e.key !== " ") {
35
+ return;
36
+ }
37
+ e.preventDefault();
38
+ const linkEl = e.target;
39
+ linkEl.classList.remove("zen-menu-button__action--active");
40
+ if (linkEl.dataset.spaceDown) {
41
+ delete linkEl.dataset.spaceDown;
42
+ linkEl.click();
43
+ }
44
+ }
45
+ });
46
+ const getMenuButtonActionClassName = (hasChildren, hasState, isActive, disabled, destructiveClass, driveClasses) => classNames([
47
+ "zen-menu-button__action",
48
+ "zen-button",
49
+ "zen-caption",
50
+ hasChildren ? "zen-menu-button__action--has-children" : "",
51
+ hasState && isActive ? "zen-menu-button__action--active" : "",
52
+ disabled ? "zen-menu-button__action--disabled" : "",
53
+ disabled ? "zen-button--disabled" : "",
54
+ disabled ? "zen-button--disabled-focusable" : "",
55
+ destructiveClass,
56
+ driveClasses || ""
57
+ ]);
58
+ const getMenuLinkActionClassName = (disabled, destructiveClass, driveClasses) => classNames(["zen-menu-button__action", "zen-caption", disabled ? "zen-menu-button__action--disabled" : "", destructiveClass, driveClasses || ""]);
59
+ // An <a> without `href` isn't tabbable, so `tabIndex="0"` keeps a disabled link item in the tab order.
60
+ const getMenuLinkAccessibilityProps = (disabled, link) => ({
61
+ href: disabled || !isSafeHref(link) ? undefined : link,
62
+ tabIndex: disabled ? 0 : undefined,
63
+ "aria-disabled": disabled
64
+ });
65
+ const getMenuItemRole = (hasState) => (hasState ? "menuitemcheckbox" : "menuitem");
66
+ const getMenuItemAriaChecked = (hasState, isActive) => (hasState ? isActive : undefined);
67
+ const createMenuIcon = (iconComponent, size, className) => iconComponent ? createElement(iconComponent, { size, className }) : null;
68
+ const resolveTarget = (target, iconOpen) => target !== null && target !== void 0 ? target : (iconOpen ? "_blank" : undefined);
69
+ export const MenuButton = ({ id, onClick, hasChildren, disabled, icon, iconOpen, destructive, name, link, target, rel, className = "", active = null, ref, dataAnalyticsId }) => {
13
70
  const { hasState, isActive } = getMenuButtonState(active, disabled);
14
71
  const driveMenuButtonActionClasses = useDriveClassName("zen-menu-button__action");
15
72
  const isDrive = useDrive();
73
+ const iconSize = isDrive ? "huge" : "large";
74
+ const destructiveClass = destructive ? "zen-menu-button__action--destructive" : "";
75
+ const effectiveTarget = resolveTarget(target, iconOpen);
16
76
  const ChevronIcon = useDirectionalIcon(IconChevronRight, IconChevronLeft);
17
- const linkEvents = useMemo(() => ({
18
- onKeyDown: e => {
19
- if (e.key === " ") {
20
- e.preventDefault();
21
- const linkEl = e.target;
22
- linkEl.dataset.spaceDown = "1";
23
- linkEl.classList.add("zen-menu-button__action--active");
24
- }
25
- },
26
- onKeyUp: e => {
27
- if (e.key === " ") {
28
- e.preventDefault();
29
- const linkEl = e.target;
30
- linkEl.classList.remove("zen-menu-button__action--active");
31
- if (linkEl.dataset.spaceDown) {
32
- delete linkEl.dataset.spaceDown;
33
- linkEl.click();
34
- }
35
- }
36
- }
37
- }), []);
38
- const onClickHandler = useCallback((e) => {
39
- onClick === null || onClick === void 0 ? void 0 : onClick(id, e);
40
- }, [id, onClick]);
41
- const buttonTemplate = (_jsxs("button", { type: "button", "data-id": id, ref: ref, disabled: !!disabled, title: name, className: classNames([
42
- "zen-menu-button__action",
43
- "zen-button",
44
- "zen-caption",
45
- hasChildren ? "zen-menu-button__action--has-children" : "",
46
- hasState && isActive ? "zen-menu-button__action--active" : "",
47
- driveMenuButtonActionClasses || ""
48
- ]), role: hasState ? "menuitemcheckbox" : "menuitem", onClick: onClickHandler, "aria-checked": hasState ? isActive : undefined, "data-analytics-id": dataAnalyticsId, children: [!!icon &&
49
- createElement(icon, {
50
- size: isDrive ? "huge" : "large",
51
- className: classNames(["zen-caption__pre-content", "zen-menu-button__icon"])
52
- }), _jsx("span", { className: "zen-menu-button__action-text", children: name }), !!hasChildren && (_jsx(ChevronIcon, { size: isDrive ? "huge" : "large", className: classNames(["zen-caption__pre-content", "zen-menu-button__more-icon"]) }))] }));
53
- const linkTemplate = (_jsxs("a", Object.assign({ "data-id": id, role: "menuitem", className: classNames([
54
- "zen-menu-button__action",
55
- "zen-caption",
56
- disabled ? "zen-menu-button__action--disabled" : "",
57
- driveMenuButtonActionClasses || ""
58
- ]), href: disabled || !isSafeHref(link) ? undefined : link, "aria-disabled": disabled, onClick: onClickHandler, target: target, rel: getSafeRel(rel, target), "data-analytics-id": dataAnalyticsId }, linkEvents, { children: [!!icon &&
59
- createElement(icon, {
60
- size: isDrive ? "huge" : "large",
61
- className: "zen-caption__pre-content"
62
- }), name] })));
77
+ const linkEvents = useMemo(() => createDisabledGuardedLinkKeyEvents(disabled), [disabled]);
78
+ const onClickHandler = useCallback((e) => handleDisabledGuardedClick(e, disabled, id, onClick), [id, onClick, disabled]);
79
+ const iconAfterElement = createMenuIcon(iconOpen ? IconOpen : undefined, iconSize, "zen-menu-button__icon-after");
80
+ const buttonTemplate = (_jsxs("button", { type: "button", "data-id": id, ref: ref, title: name, className: getMenuButtonActionClassName(hasChildren, hasState, isActive, disabled, destructiveClass, driveMenuButtonActionClasses), role: getMenuItemRole(hasState), onClick: onClickHandler, "aria-disabled": disabled ? true : undefined, "aria-checked": getMenuItemAriaChecked(hasState, isActive), "data-analytics-id": dataAnalyticsId, children: [createMenuIcon(icon, iconSize, classNames(["zen-caption__pre-content", "zen-menu-button__icon"])), _jsx("span", { className: "zen-menu-button__action-text", children: name }), iconAfterElement, !!hasChildren && _jsx(ChevronIcon, { size: iconSize, className: classNames(["zen-caption__pre-content", "zen-menu-button__more-icon"]) })] }));
81
+ const linkTemplate = (_jsxs("a", Object.assign({ "data-id": id, role: "menuitem", className: getMenuLinkActionClassName(disabled, destructiveClass, driveMenuButtonActionClasses) }, getMenuLinkAccessibilityProps(disabled, link), { onClick: onClickHandler, target: effectiveTarget, rel: getSafeRel(rel, effectiveTarget), "data-analytics-id": dataAnalyticsId }, linkEvents, { children: [createMenuIcon(icon, iconSize, "zen-caption__pre-content"), iconAfterElement ? _jsx("span", { className: "zen-menu-button__action-text", children: name }) : name, iconAfterElement] })));
63
82
  return (_jsx("li", { role: "presentation", className: classNames(["zen-menu-button", className]), children: link ? linkTemplate : buttonTemplate }));
64
83
  };
@@ -6,7 +6,7 @@ import { ControlledPopup } from "../../controlledPopup/controlledPopup";
6
6
  import { classNames } from "../../commonHelpers/classNames/classNames";
7
7
  import { useMenuItemCore } from "../utils/useMenuItemCore";
8
8
  export { isMenuItem } from "../utils/isMenuItem";
9
- export const MenuItem = ({ id, children, name, icon, disabled, onClick, link, target, rel, isMobile = false, setIsOpen, trigger, className, active, alignment, dataAnalyticsId }) => {
9
+ export const MenuItem = ({ id, children, name, icon, iconOpen, destructive, disabled, onClick, link, target, rel, isMobile = false, setIsOpen, trigger, className, active, alignment, dataAnalyticsId }) => {
10
10
  const { ref, isOpen, hasChildren, content, openedViaKeyboard, contentAlignment, path, onOpenBranch, handleOpenChange } = useMenuItemCore({
11
11
  id,
12
12
  children,
@@ -40,10 +40,10 @@ export const MenuItem = ({ id, children, name, icon, disabled, onClick, link, ta
40
40
  onClick === null || onClick === void 0 ? void 0 : onClick(id, e);
41
41
  }, [onClick, onOpenBranch, id, trigger]);
42
42
  if (!hasChildren) {
43
- return (_jsx(MenuButton, { id: id, name: name, icon: icon, disabled: disabled, link: link, target: target, rel: rel, onClick: memoizedDesktopActionOnClick, className: className, active: active, hasChildren: false, dataAnalyticsId: dataAnalyticsId }, id));
43
+ return (_jsx(MenuButton, { id: id, name: name, icon: icon, iconOpen: iconOpen, destructive: destructive, disabled: disabled, link: link, target: target, rel: rel, onClick: memoizedDesktopActionOnClick, className: className, active: active, hasChildren: false, dataAnalyticsId: dataAnalyticsId }, id));
44
44
  }
45
45
  if (isMobile) {
46
- return (_jsx(MenuButton, { id: id, name: name, icon: icon, disabled: disabled, link: link, target: target, rel: rel, onClick: memoizedMobileActionOnClick, active: active, hasChildren: true, dataAnalyticsId: dataAnalyticsId }, id));
46
+ return (_jsx(MenuButton, { id: id, name: name, icon: icon, iconOpen: iconOpen, destructive: destructive, disabled: disabled, link: link, target: target, rel: rel, onClick: memoizedMobileActionOnClick, active: active, hasChildren: true, dataAnalyticsId: dataAnalyticsId }, id));
47
47
  }
48
48
  let popupTrigger;
49
49
  if (trigger) {
@@ -53,7 +53,7 @@ export const MenuItem = ({ id, children, name, icon, disabled, onClick, link, ta
53
53
  });
54
54
  }
55
55
  else {
56
- popupTrigger = (_jsx(MenuButton, { id: id, ref: ref, name: name, icon: icon, disabled: disabled, hasChildren: true, onClick: memoizedTriggerOnClick, active: active, dataAnalyticsId: dataAnalyticsId }, id));
56
+ popupTrigger = (_jsx(MenuButton, { id: id, ref: ref, name: name, icon: icon, iconOpen: iconOpen, destructive: destructive, disabled: disabled, hasChildren: true, onClick: memoizedTriggerOnClick, active: active, dataAnalyticsId: dataAnalyticsId }, id));
57
57
  }
58
58
  return (_jsxs(Fragment, { children: [popupTrigger, _jsx(ControlledPopup, { className: classNames([`zen-controlled-menu-submenu--${path.length}`]), useTrapFocusWithTrigger: openedViaKeyboard ? "on" : "withTrigger", alignment: contentAlignment, triggerRef: ref, isOpen: isOpen, onOpenChange: handleOpenChange, ariaLabel: popupTrigger.props.name, recalculateOnScroll: true, children: _jsx("ul", { role: "menu", className: "zen-menu-item", children: content }) })] }, id));
59
59
  };
@@ -6,6 +6,7 @@ import { MiniTabsHeaderItem } from "./miniTabsHeaderItem";
6
6
  import { MiniTabsItem } from "./miniTabsItem";
7
7
  import { tabsKeyboardHandler } from "../commonHelpers/tabsKeyboard";
8
8
  import { getChildrenForRender } from "./miniTabsHelper";
9
+ import { useIsRTL } from "../utils/localization/useIsRTL";
9
10
  export var MiniTabsSize;
10
11
  (function (MiniTabsSize) {
11
12
  MiniTabsSize["Small"] = "small";
@@ -18,16 +19,17 @@ export const MiniTabs = ({ activeTabId, onTabChange, children, size = MiniTabsSi
18
19
  const [tabs, setTabs] = useState([]);
19
20
  const activeButtonRef = useRef(null);
20
21
  const tabsRef = useRef(null);
22
+ const isRTL = useIsRTL();
21
23
  const handleTabItemClick = (e) => {
22
24
  const newState = e.target.id || e.currentTarget.id || undefined;
23
25
  newState && newState !== activeTabId && onTabChange(newState);
24
26
  };
25
27
  const keyDownHandler = useCallback((e) => {
26
- const newActiveTabId = tabsKeyboardHandler(e, tabs, activeTabId);
28
+ const newActiveTabId = tabsKeyboardHandler(e, tabs, activeTabId, isRTL);
27
29
  if (newActiveTabId && newActiveTabId !== activeTabId) {
28
30
  onTabChange(newActiveTabId);
29
31
  }
30
- }, [tabs, activeTabId, onTabChange]);
32
+ }, [tabs, activeTabId, onTabChange, isRTL]);
31
33
  useEffect(() => setTabs(getChildrenForRender(children).slice(0, maxTabsValue)), [children]);
32
34
  useEffect(() => {
33
35
  var _a;
@@ -13,6 +13,6 @@ export interface IPageHeaderButton extends Omit<IButton, "onClick" | "icon" | "t
13
13
  }
14
14
  export declare const PageHeaderButtonDisplayName = "PageHeaderButton";
15
15
  export declare const PageHeaderButton: {
16
- ({ id, children, icon, iconPosition, className, onClick, title, ...restProps }: IPageHeaderButton): import("react/jsx-runtime").JSX.Element;
16
+ ({ id, children, icon, iconPosition, className, onClick, title, disabled, focusableWhenDisabled, ...restProps }: IPageHeaderButton): import("react/jsx-runtime").JSX.Element;
17
17
  displayName: string;
18
18
  };
@@ -14,9 +14,11 @@ import { ButtonIconPosition, TextIconButton } from "../textIconButton/textIconBu
14
14
  import { classNames } from "../commonHelpers/classNames/classNames";
15
15
  export const PageHeaderButtonDisplayName = "PageHeaderButton";
16
16
  export const PageHeaderButton = (_a) => {
17
- var { id, children, icon, iconPosition = ButtonIconPosition.Start, className = "", onClick, title } = _a, restProps = __rest(_a, ["id", "children", "icon", "iconPosition", "className", "onClick", "title"]);
17
+ var { id, children, icon, iconPosition = ButtonIconPosition.Start, className = "", onClick, title, disabled, focusableWhenDisabled } = _a, restProps = __rest(_a, ["id", "children", "icon", "iconPosition", "className", "onClick", "title", "disabled", "focusableWhenDisabled"]);
18
18
  const fullClassName = classNames(["zen-page-header-button", className || ""]);
19
- const props = Object.assign({}, restProps);
19
+ const props = Object.assign(Object.assign({}, restProps), { disabled,
20
+ // Defaults on when disabled; pass `focusableWhenDisabled={false}` to opt back into native `disabled`.
21
+ focusableWhenDisabled: focusableWhenDisabled !== null && focusableWhenDisabled !== void 0 ? focusableWhenDisabled : Boolean(disabled) });
20
22
  return (_jsx(TextIconButton, Object.assign({ id: id, icon: icon, title: title, iconPosition: iconPosition, className: fullClassName, onClick: onClick ? e => onClick(id, e) : undefined }, props, { children: children })));
21
23
  };
22
24
  PageHeaderButton.displayName = PageHeaderButtonDisplayName;
@@ -3,14 +3,29 @@ import "./pagination.less";
3
3
  import { IZenComponentProps } from "../commonHelpers/zenComponent";
4
4
  import { PaginationType } from "./paginationType";
5
5
  export interface IPagination extends IZenComponentProps {
6
- activePage: number;
6
+ /**
7
+ * Required for the default "paged" variant (see `IPaginationPaged`, enforced there). Unused —
8
+ * and not required — when `variant === "loaded"`, since there are no pages to be "active" on.
9
+ */
10
+ activePage?: number;
7
11
  total: number;
8
- perPage: number;
9
- onChange: (newActivePage: number) => void;
12
+ /** Required for "paged" (see `IPaginationPaged`). Unused by "loaded". */
13
+ perPage?: number;
14
+ /** Required for "paged" (see `IPaginationPaged`). Unused by "loaded". */
15
+ onChange?: (newActivePage: number) => void;
10
16
  className?: string;
11
17
  includeText?: boolean;
12
18
  type?: PaginationType;
13
19
  gridRef?: RefObject<HTMLElement | null>;
14
20
  disabled?: boolean;
21
+ /**
22
+ * "paged" (default): standard prev/next controls + "Showing X - Y of Z" text.
23
+ * "loaded": desktop-infinite-scroll variant — prev/next controls are always hidden (there are
24
+ * no pages) and the text reads "1-{loadedCount} of {total}" instead. Used by Table when
25
+ * `onScrollEnd` is wired and a `Table.Pagination` child supplies `total`.
26
+ */
27
+ variant?: "paged" | "loaded";
28
+ /** Number of rows currently loaded/rendered. Only used when `variant === "loaded"`. */
29
+ loadedCount?: number;
15
30
  }
16
- export declare const Pagination: ({ className, activePage, total, perPage, onChange, disabled, includeText, type, gridRef }: IPagination) => import("react/jsx-runtime").JSX.Element;
31
+ export declare const Pagination: ({ variant, ...props }: IPagination) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { useMemo } from "react";
3
14
  import { classNames } from "../commonHelpers/classNames/classNames";
@@ -5,7 +16,12 @@ import { PaginationArrow } from "./paginationArrow";
5
16
  import { PaginationButtonsRow } from "./paginationButtonsRow";
6
17
  import { PaginationText } from "./paginationText/paginationText";
7
18
  import { PaginationType } from "./paginationType";
8
- export const Pagination = ({ className, activePage, total, perPage, onChange, disabled, includeText = false, type = PaginationType.Compact, gridRef }) => {
19
+ // Desktop infinite scroll: there are no pages, so the page-control buttons are skipped entirely and
20
+ // only the compact "1-{loadedCount} of {total}" text is rendered. Split out as its own tiny
21
+ // component (rather than a branch inside `Pagination`) so it doesn't count against that function's
22
+ // complexity budget.
23
+ const PaginationLoaded = ({ className, type = PaginationType.Compact, total, includeText = false, loadedCount = 0 }) => (_jsx("div", { className: classNames(["zen-pagination", `zen-pagination--type-${type}`, className ? className : ""]), children: includeText ? _jsx(PaginationText, { amount: total, from: total === 0 ? 0 : 1, to: Math.min(loadedCount, total), variant: "loaded" }) : null }));
24
+ const PaginationPaged = ({ className, activePage, total, perPage, onChange, disabled, includeText = false, type = PaginationType.Compact, gridRef }) => {
9
25
  var _a, _b;
10
26
  const gridNode = ((_a = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current) === null || _a === void 0 ? void 0 : _a.classList.contains("zen-data-grid")) ? gridRef.current : (_b = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current) === null || _b === void 0 ? void 0 : _b.querySelector(".zen-data-grid");
11
27
  const displayedPagesCount = 6;
@@ -48,3 +64,7 @@ export const Pagination = ({ className, activePage, total, perPage, onChange, di
48
64
  const isSinglePage = total <= perPage;
49
65
  return (_jsxs("div", { className: classNames(["zen-pagination", `zen-pagination--type-${type}`, className ? className : ""]), children: [includeText ? (_jsx(PaginationText, { amount: total, from: total === 0 ? total : activePage * perPage + 1, to: Math.min((activePage + 1) * perPage, total) })) : null, isSinglePage ? null : (_jsx(PaginationArrow, { value: "previous", disabled: activePage === 0 || disabled, arrowButtonHandler: () => handlePageChange(activePage - 1), type: type })), type === PaginationType.Normal ? (_jsx(PaginationButtonsRow, { paginationValues: getPaginationValues(), activePage: activePage, upperBoundIndex: totalNumberOfPages - 1, onChange: handlePageChange })) : null, isSinglePage ? null : (_jsx(PaginationArrow, { value: "next", disabled: activePage >= totalNumberOfPages - 1 || disabled, arrowButtonHandler: () => handlePageChange(activePage + 1), type: type }))] }));
50
66
  };
67
+ export const Pagination = (_a) => {
68
+ var { variant = "paged" } = _a, props = __rest(_a, ["variant"]);
69
+ return variant === "loaded" ? (_jsx(PaginationLoaded, { className: props.className, type: props.type, total: props.total, includeText: props.includeText, loadedCount: props.loadedCount })) : (_jsx(PaginationPaged, Object.assign({}, props)));
70
+ };
@@ -2,7 +2,13 @@ interface IPaginationText {
2
2
  amount: number;
3
3
  from: number;
4
4
  to: number;
5
+ /**
6
+ * "showing" (default): the paged-table text, e.g. "Showing 1 - 10 of 100".
7
+ * "loaded": the compact desktop-infinite-scroll variant, e.g. "1-10 of 100", rendered in
8
+ * place of page-control buttons (which don't apply when there are no pages).
9
+ */
10
+ variant?: "showing" | "loaded";
5
11
  }
6
- export declare const PaginationText: ({ amount, from, to }: IPaginationText) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const PaginationText: ({ amount, from, to, variant }: IPaginationText) => import("react/jsx-runtime").JSX.Element;
7
13
  export declare const TRANSLATIONS: string[];
8
14
  export {};