@geotab/zenith 3.2.0 → 3.3.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 (211) hide show
  1. package/README.md +25 -1
  2. package/dist/card/card.d.ts +3 -0
  3. package/dist/card/card.js +15 -5
  4. package/dist/card/components/cardToggle/cardToggle.d.ts +5 -0
  5. package/dist/card/components/cardToggle/cardToggle.js +7 -0
  6. package/dist/card/components/title.js +3 -3
  7. package/dist/cardContainer/cardContainer.d.ts +2 -1
  8. package/dist/cardContainer/cardContainer.js +4 -3
  9. package/dist/chart/barChart/getDefaultDatasetStyle.js +8 -6
  10. package/dist/chart/lineChart/getDatasetColor.js +8 -6
  11. package/dist/chart/lineChart/useSummary.js +1 -1
  12. package/dist/chart/pieChart/getDefaultDatasetStyle.js +8 -6
  13. package/dist/chart/plugins/linePlugin/getInterpolatedValue.js +1 -1
  14. package/dist/chart/plugins/linePlugin/linePlugin.js +16 -4
  15. package/dist/commonHelpers/hooks/useEscape.js +4 -0
  16. package/dist/commonHelpers/hooks/usePillSize.d.ts +2 -1
  17. package/dist/commonHelpers/hooks/usePillSize.js +6 -3
  18. package/dist/commonStyles/colors/colors.less +9 -0
  19. package/dist/dataFeed/dataFeed.d.ts +2 -1
  20. package/dist/dataFeed/dataFeed.js +18 -3
  21. package/dist/dataFeed/dataFeedColumnsItems.d.ts +2 -1
  22. package/dist/dataFeed/dataFeedColumnsItems.js +6 -4
  23. package/dist/dataGrid/cell/cell.d.ts +2 -1
  24. package/dist/dataGrid/cell/cell.js +2 -1
  25. package/dist/dataGrid/dataGrid.d.ts +3 -1
  26. package/dist/dataGrid/dataGrid.js +7 -2
  27. package/dist/dataGrid/row/row.d.ts +3 -1
  28. package/dist/dataGrid/row/row.js +3 -3
  29. package/dist/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +8 -4
  30. package/dist/divider/divider.d.ts +5 -5
  31. package/dist/divider/divider.js +6 -2
  32. package/dist/filtersBar/components/filtersBarPeriodPicker/filtersBarPeriodPicker.js +2 -2
  33. package/dist/footerButtons/footerButtons.d.ts +4 -0
  34. package/dist/footerButtons/footerButtons.js +4 -6
  35. package/dist/groupsFilterRaw/groupsFilterRaw.js +1 -0
  36. package/dist/index.css +478 -255
  37. package/dist/index.d.ts +3 -1
  38. package/dist/index.js +20 -18
  39. package/dist/lineChart/utils.js +2 -9
  40. package/dist/list/listItem/listItem.js +26 -0
  41. package/dist/mobileSheet/components/mobileSheetFooter.d.ts +1 -0
  42. package/dist/mobileSheet/components/mobileSheetFooter.js +1 -1
  43. package/dist/mobileSheet/mobileSheet.js +1 -1
  44. package/dist/pill/components/pillActionable/pillActionable.js +5 -4
  45. package/dist/pill/components/pillNonActionable/pillNonActionable.js +11 -5
  46. package/dist/pill/interfaces/pillActionable.interface.d.ts +1 -0
  47. package/dist/pill/interfaces/pillNonActionable.interface.d.ts +1 -0
  48. package/dist/pillExpandable/pillExpandable.js +6 -6
  49. package/dist/rangeRaw/rangeRaw.js +1 -0
  50. package/dist/selectRaw/selectRaw.js +6 -3
  51. package/dist/sidePanel/sidePanel.d.ts +1 -1
  52. package/dist/sidePanel/sidePanel.js +7 -3
  53. package/dist/table/children/tableDetailPanel.d.ts +9 -0
  54. package/dist/table/children/tableDetailPanel.js +6 -0
  55. package/dist/table/children/useTableChildren.d.ts +2 -1
  56. package/dist/table/children/useTableChildren.js +17 -2
  57. package/dist/table/detailPanel/detailPanel.d.ts +4 -0
  58. package/dist/table/detailPanel/detailPanel.js +140 -0
  59. package/dist/table/detailPanel/detailPanelHeader.d.ts +4 -0
  60. package/dist/table/detailPanel/detailPanelHeader.js +105 -0
  61. package/dist/table/detailPanel/interfaces.d.ts +8 -0
  62. package/dist/table/detailPanel/interfaces.js +2 -0
  63. package/dist/table/table.d.ts +6 -1
  64. package/dist/table/table.js +248 -68
  65. package/dist/utils/localization/translations/cs.json +3 -1
  66. package/dist/utils/localization/translations/da-DK.json +3 -1
  67. package/dist/utils/localization/translations/de.json +3 -1
  68. package/dist/utils/localization/translations/en-json.d.ts +315 -0
  69. package/dist/utils/localization/translations/en-json.js +318 -0
  70. package/dist/utils/localization/translations/en.json +5 -1
  71. package/dist/utils/localization/translations/es.json +3 -1
  72. package/dist/utils/localization/translations/fi-FI.json +3 -1
  73. package/dist/utils/localization/translations/fr-FR.json +3 -1
  74. package/dist/utils/localization/translations/fr.json +3 -1
  75. package/dist/utils/localization/translations/hu-HU.json +3 -1
  76. package/dist/utils/localization/translations/id.json +3 -1
  77. package/dist/utils/localization/translations/it.json +3 -1
  78. package/dist/utils/localization/translations/ja.json +3 -1
  79. package/dist/utils/localization/translations/ko-KR.json +3 -1
  80. package/dist/utils/localization/translations/ms.json +3 -1
  81. package/dist/utils/localization/translations/nb-NO.json +3 -1
  82. package/dist/utils/localization/translations/nl.json +3 -1
  83. package/dist/utils/localization/translations/pl.json +3 -1
  84. package/dist/utils/localization/translations/pt-BR.json +3 -1
  85. package/dist/utils/localization/translations/sk-SK.json +3 -1
  86. package/dist/utils/localization/translations/sv.json +3 -1
  87. package/dist/utils/localization/translations/th.json +3 -1
  88. package/dist/utils/localization/translations/tr.json +3 -1
  89. package/dist/utils/localization/translations/zh-Hans.json +3 -1
  90. package/dist/utils/localization/translations/zh-TW.json +3 -1
  91. package/esm/card/card.d.ts +3 -0
  92. package/esm/card/card.js +15 -5
  93. package/esm/card/components/cardToggle/cardToggle.d.ts +5 -0
  94. package/esm/card/components/cardToggle/cardToggle.js +3 -0
  95. package/esm/card/components/title.js +3 -3
  96. package/esm/cardContainer/cardContainer.d.ts +2 -1
  97. package/esm/cardContainer/cardContainer.js +4 -3
  98. package/esm/chart/barChart/getDefaultDatasetStyle.js +8 -6
  99. package/esm/chart/lineChart/getDatasetColor.js +8 -6
  100. package/esm/chart/lineChart/useSummary.js +1 -1
  101. package/esm/chart/pieChart/getDefaultDatasetStyle.js +8 -6
  102. package/esm/chart/plugins/linePlugin/getInterpolatedValue.js +1 -1
  103. package/esm/chart/plugins/linePlugin/linePlugin.js +16 -4
  104. package/esm/commonHelpers/hooks/useEscape.js +4 -0
  105. package/esm/commonHelpers/hooks/usePillSize.d.ts +2 -1
  106. package/esm/commonHelpers/hooks/usePillSize.js +6 -3
  107. package/esm/commonStyles/colors/colorsConstant.d.ts +6 -0
  108. package/esm/commonStyles/colors/colorsConstant.js +50 -0
  109. package/esm/dataFeed/dataFeed.d.ts +2 -1
  110. package/esm/dataFeed/dataFeed.js +18 -3
  111. package/esm/dataFeed/dataFeedColumnsItems.d.ts +2 -1
  112. package/esm/dataFeed/dataFeedColumnsItems.js +6 -4
  113. package/esm/dataGrid/cell/cell.d.ts +2 -1
  114. package/esm/dataGrid/cell/cell.js +2 -1
  115. package/esm/dataGrid/dataGrid.d.ts +3 -1
  116. package/esm/dataGrid/dataGrid.js +7 -2
  117. package/esm/dataGrid/row/row.d.ts +3 -1
  118. package/esm/dataGrid/row/row.js +3 -3
  119. package/esm/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +8 -4
  120. package/esm/divider/divider.d.ts +5 -5
  121. package/esm/divider/divider.js +6 -2
  122. package/esm/filtersBar/components/filtersBarPeriodPicker/filtersBarPeriodPicker.js +2 -2
  123. package/esm/footerButtons/footerButtons.d.ts +4 -0
  124. package/esm/footerButtons/footerButtons.js +4 -6
  125. package/esm/groupsFilterRaw/groupsFilterRaw.js +1 -0
  126. package/esm/index.d.ts +3 -1
  127. package/esm/index.js +1 -0
  128. package/esm/lineChart/utils.js +2 -9
  129. package/esm/list/listItem/listItem.js +26 -0
  130. package/esm/mobileSheet/components/mobileSheetFooter.d.ts +1 -0
  131. package/esm/mobileSheet/components/mobileSheetFooter.js +1 -1
  132. package/esm/mobileSheet/mobileSheet.js +1 -1
  133. package/esm/pill/components/pillActionable/pillActionable.js +5 -4
  134. package/esm/pill/components/pillNonActionable/pillNonActionable.js +11 -5
  135. package/esm/pill/interfaces/pillActionable.interface.d.ts +1 -0
  136. package/esm/pill/interfaces/pillNonActionable.interface.d.ts +1 -0
  137. package/esm/pillExpandable/pillExpandable.js +6 -6
  138. package/esm/rangeRaw/rangeRaw.js +1 -0
  139. package/esm/selectRaw/selectRaw.js +6 -3
  140. package/esm/sidePanel/sidePanel.d.ts +1 -1
  141. package/esm/sidePanel/sidePanel.js +7 -3
  142. package/esm/table/children/tableDetailPanel.d.ts +9 -0
  143. package/esm/table/children/tableDetailPanel.js +2 -0
  144. package/esm/table/children/useTableChildren.d.ts +2 -1
  145. package/esm/table/children/useTableChildren.js +17 -2
  146. package/esm/table/detailPanel/detailPanel.d.ts +4 -0
  147. package/esm/table/detailPanel/detailPanel.js +131 -0
  148. package/esm/table/detailPanel/detailPanelHeader.d.ts +4 -0
  149. package/esm/table/detailPanel/detailPanelHeader.js +96 -0
  150. package/esm/table/detailPanel/interfaces.d.ts +8 -0
  151. package/esm/table/table.d.ts +6 -1
  152. package/esm/table/table.js +201 -61
  153. package/esm/utils/localization/translations/cs.json +3 -1
  154. package/esm/utils/localization/translations/da-DK.json +3 -1
  155. package/esm/utils/localization/translations/de.json +3 -1
  156. package/esm/utils/localization/translations/en-json.d.ts +315 -0
  157. package/esm/utils/localization/translations/en-json.js +315 -0
  158. package/esm/utils/localization/translations/en.json +5 -1
  159. package/esm/utils/localization/translations/es.json +3 -1
  160. package/esm/utils/localization/translations/fi-FI.json +3 -1
  161. package/esm/utils/localization/translations/fr-FR.json +3 -1
  162. package/esm/utils/localization/translations/fr.json +3 -1
  163. package/esm/utils/localization/translations/hu-HU.json +3 -1
  164. package/esm/utils/localization/translations/id.json +3 -1
  165. package/esm/utils/localization/translations/it.json +3 -1
  166. package/esm/utils/localization/translations/ja.json +3 -1
  167. package/esm/utils/localization/translations/ko-KR.json +3 -1
  168. package/esm/utils/localization/translations/ms.json +3 -1
  169. package/esm/utils/localization/translations/nb-NO.json +3 -1
  170. package/esm/utils/localization/translations/nl.json +3 -1
  171. package/esm/utils/localization/translations/pl.json +3 -1
  172. package/esm/utils/localization/translations/pt-BR.json +3 -1
  173. package/esm/utils/localization/translations/sk-SK.json +3 -1
  174. package/esm/utils/localization/translations/sv.json +3 -1
  175. package/esm/utils/localization/translations/th.json +3 -1
  176. package/esm/utils/localization/translations/tr.json +3 -1
  177. package/esm/utils/localization/translations/zh-Hans.json +3 -1
  178. package/esm/utils/localization/translations/zh-TW.json +3 -1
  179. package/package.json +7 -7
  180. package/dist/nav/storyHelpers/storyDecorator.d.ts +0 -35
  181. package/dist/nav/storyHelpers/storyDecorator.js +0 -79
  182. package/esm/nav/storyHelpers/storyDecorator.d.ts +0 -35
  183. package/esm/nav/storyHelpers/storyDecorator.js +0 -74
  184. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/api/fetchEntities.d.ts +0 -3
  185. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/api/fetchEntities.js +0 -32
  186. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/api/gridModel.d.ts +0 -81
  187. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/api/gridModel.js +0 -113
  188. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/ColumnWaiting.d.ts +0 -4
  189. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/ColumnWaiting.js +0 -4
  190. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/EntitiesListAction.d.ts +0 -18
  191. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/EntitiesListAction.js +0 -193
  192. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/constants/index.d.ts +0 -1
  193. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/constants/index.js +0 -1
  194. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/interfaces/entity.d.ts +0 -7
  195. package/esm/storybookHelpers/fieldDelayRenderer.d.ts +0 -5
  196. package/esm/storybookHelpers/fieldDelayRenderer.js +0 -20
  197. package/esm/storybookHelpers/storyFeedbackProviderDecorator.d.ts +0 -2
  198. package/esm/storybookHelpers/storyFeedbackProviderDecorator.js +0 -16
  199. package/esm/storybookHelpers/storyGlobalWrapper.d.ts +0 -2
  200. package/esm/storybookHelpers/storyGlobalWrapper.js +0 -3
  201. package/esm/storybookHelpers/storyItem.d.ts +0 -8
  202. package/esm/storybookHelpers/storyItem.js +0 -17
  203. package/esm/storybookHelpers/storyLanguageDecorator.d.ts +0 -2
  204. package/esm/storybookHelpers/storyLanguageDecorator.js +0 -4
  205. package/esm/storybookHelpers/storyQueryClientProvider.d.ts +0 -2
  206. package/esm/storybookHelpers/storyQueryClientProvider.js +0 -15
  207. package/esm/storybookHelpers/storyThemeDecorator.d.ts +0 -2
  208. package/esm/storybookHelpers/storyThemeDecorator.js +0 -15
  209. package/esm/storybookHelpers/storyTopWindowDecorator.d.ts +0 -2
  210. package/esm/storybookHelpers/storyTopWindowDecorator.js +0 -4
  211. /package/esm/{storybookHelpers/dataGridWithDifferentCellOptions/interfaces/entity.js → table/detailPanel/interfaces.js} +0 -0
@@ -243,6 +243,7 @@
243
243
  "Close filter": "關閉篩選器",
244
244
  "Column Settings": "欄設定",
245
245
  "Category": "種類",
246
+ "Details": "詳細資訊",
246
247
  "Select visible columns": "選取可見欄",
247
248
  "Selected": "已選取",
248
249
  "This field is required.": "此欄位為必填。",
@@ -255,5 +256,6 @@
255
256
  "Remove": "移除",
256
257
  "Confirm": "確認",
257
258
  "Clear all": "清除全部",
258
- "Reload": "重新載入"
259
+ "Reload": "重新載入",
260
+ "View details": "檢視詳細資訊"
259
261
  }
@@ -10,6 +10,7 @@ import { TooltipSize } from "../tooltip/tooltip";
10
10
  import { IZenComponentProps, IZenFormLayoutItem, IZenGridItem } from "../commonHelpers/zenComponent";
11
11
  import { ICardButton } from "./components/cardButton/cardButton";
12
12
  import { IIcon } from "../icons/icon";
13
+ import { IToggleButton } from "../toggleButton/toggleButton";
13
14
  export declare const DEFAULT_CARD_SIZE: TContainerSize;
14
15
  export interface ICard extends IZenComponentProps, IZenGridItem, IZenFormLayoutItem {
15
16
  size?: TContainerSize | IAbsoluteSize;
@@ -48,5 +49,7 @@ export declare const Card: FC<ICard> & {
48
49
  Content: FC<IContent>;
49
50
  } & {
50
51
  Button: FC<ICardButton>;
52
+ } & {
53
+ Toggle: FC<IToggleButton>;
51
54
  };
52
55
  export declare const TRANSLATIONS: string[];
package/esm/card/card.js CHANGED
@@ -29,7 +29,8 @@ import { FavoriteButton } from "../favoriteButton/favoriteButton";
29
29
  import { getIconFromStatus } from "./helpers/getIconFromStatus";
30
30
  import { getIconTypeFromStatus } from "./helpers/getIconTypeFromStatus";
31
31
  import { isFormSection } from "../formSection/utils/isFormSection";
32
- // import { FormSection } from "../formSection/formSection";
32
+ import { CardToggle } from "./components/cardToggle/cardToggle";
33
+ import { ToggleButton } from "../toggleButton/toggleButton";
33
34
  injectString("cs", "Actions", "Akce");
34
35
  injectString("da-DK", "Actions", "Handlinger");
35
36
  injectString("de", "Actions", "Aktionen");
@@ -60,6 +61,7 @@ export const Card =
60
61
  // eslint-disable-next-line complexity
61
62
  props => {
62
63
  const {
64
+ id,
63
65
  size,
64
66
  children,
65
67
  title,
@@ -104,7 +106,8 @@ props => {
104
106
  useCardSize(setCardSize, containerRef, isAbsoluteSize(size) ? getContainerSize(size.width) : size || "S");
105
107
  const {
106
108
  actions,
107
- content
109
+ content,
110
+ toggle
108
111
  } = useMemo(() => {
109
112
  if (!children) {
110
113
  return {
@@ -115,6 +118,7 @@ props => {
115
118
  if (Array.isArray(children)) {
116
119
  const acts = [];
117
120
  const cnt = [];
121
+ let tgl;
118
122
  React.Children.forEach(children, el => {
119
123
  if (!el) {
120
124
  return;
@@ -135,10 +139,14 @@ props => {
135
139
  if (el.type === Card.Content || isFormSection(el)) {
136
140
  cnt.push(el);
137
141
  }
142
+ if (el.type === Card.Toggle) {
143
+ tgl = el;
144
+ }
138
145
  });
139
146
  return {
140
147
  actions: acts,
141
- content: cnt
148
+ content: cnt,
149
+ toggle: tgl
142
150
  };
143
151
  }
144
152
  return {
@@ -210,6 +218,7 @@ props => {
210
218
  const isHeaderPrimaryVisible = title || icon || link || onClick || !!headerActions.length || date || !!favoriteButton || !!tooltip || !!menuActions.length;
211
219
  const isHeaderVisible = isHeaderPrimaryVisible || secondary;
212
220
  return _jsxs(CardContainer, {
221
+ id: id,
213
222
  isMobile: isMobile,
214
223
  fullWidth: isFullWidth,
215
224
  fullHeight: isFullHeight,
@@ -244,7 +253,7 @@ props => {
244
253
  tooltip: tooltip,
245
254
  tooltipAlignment: tooltipAlignment,
246
255
  tooltipSize: tooltipSize
247
- }), !!menuActions.length && _jsx(Menu, {
256
+ }), toggle ? _jsx(ToggleButton, Object.assign({}, toggle.props)) : null, !!menuActions.length && _jsx(Menu, {
248
257
  trigger: menuTrigger,
249
258
  title: title || translate("Actions"),
250
259
  children: menuActions.map((action, index) => {
@@ -270,4 +279,5 @@ props => {
270
279
  export const TRANSLATIONS = ["Actions"];
271
280
  Card.Actions = Actions;
272
281
  Card.Content = Content;
273
- Card.Button = CardButton;
282
+ Card.Button = CardButton;
283
+ Card.Toggle = CardToggle;
@@ -0,0 +1,5 @@
1
+ import { FC } from "react";
2
+ import { IToggleButtonRaw } from "../../../toggleButtonRaw/types";
3
+ export interface ICardToggle extends IToggleButtonRaw {
4
+ }
5
+ export declare const CardToggle: FC<ICardToggle>;
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ToggleButtonRaw } from "../../../toggleButtonRaw/toggleButtonRaw";
3
+ export const CardToggle = (props) => _jsx(_Fragment, { children: _jsx(ToggleButtonRaw, Object.assign({}, props)) });
@@ -12,11 +12,11 @@ export const Title = ({ isMobile, link, target, title, id, icon, iconType, class
12
12
  const iconElement = useMemo(() => icon
13
13
  ? _jsx("div", { className: classNames(["zen-card-title__icon", iconClassName]), children: createElement(icon, { size: iconSize }) })
14
14
  : null, [icon, iconSize, iconClassName]);
15
- const chevron = useMemo(() => _jsx("div", { className: "zen-card-title__link-chevron", children: _jsx(IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) }), [iconSize]);
15
+ const chevron = useMemo(() => _jsx("span", { className: "zen-card-title__link-chevron", children: _jsx(IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) }), [iconSize]);
16
16
  const roleProp = onClick ? "button" : undefined;
17
17
  const tabIndexProp = onClick ? 0 : undefined;
18
18
  const titleClasses = classNames(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
19
19
  return _jsxs("div", { className: titleClasses, role: roleProp, onClick: onClick, tabIndex: tabIndexProp, children: [iconElement, link && !onClick
20
- ? _jsxs("a", { id: id, className: classNames(["zen-card-title__link"]), href: link, target: target, children: [_jsx("span", { title: title, className: classNames(["zen-card-title__link-text"]), children: title }), chevron] })
21
- : _jsxs(_Fragment, { children: [_jsx("span", { title: title, id: id, className: classNames(["zen-card-title__text", (isMobile && !isDrive) ? "zen-card-title__text--mobile" : "", className]), children: title }), onClick ? chevron : null] })] });
20
+ ? _jsx("a", { id: id, className: classNames(["zen-card-title__link"]), href: link, target: target, children: _jsxs("span", { title: title, className: classNames(["zen-card-title__link-text"]), children: [title, chevron] }) })
21
+ : _jsx(_Fragment, { children: _jsxs("span", { title: title, id: id, className: classNames(["zen-card-title__text", (isMobile && !isDrive) ? "zen-card-title__text--mobile" : "", className]), children: [title, onClick ? chevron : null] }) })] });
22
22
  };
@@ -13,6 +13,7 @@ export interface ICardContainer extends IZenComponentProps, IZenGridItem {
13
13
  autoHeight?: boolean;
14
14
  scrollable?: boolean;
15
15
  isMobile?: boolean;
16
+ noWidthConstraint?: boolean;
16
17
  ref?: RefObject<HTMLDivElement | null>;
17
18
  }
18
- export declare const CardContainer: ({ size, children, fullWidth, className, isMobile, fullHeight, autoHeight, scrollable, ref }: ICardContainer) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const CardContainer: ({ id, size, children, fullWidth, className, isMobile, fullHeight, autoHeight, scrollable, noWidthConstraint, ref }: ICardContainer) => import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,7 @@ import { isAbsoluteSize } from "./helpers/isAbsoluteSize";
4
4
  import { classNames } from "../commonHelpers/classNames/classNames";
5
5
  import { getSizeClass } from "./helpers/getSizeClass";
6
6
  import { useAbsoluteSize } from "./hooks/useAbsoluteSize";
7
- export const CardContainer = ({ size, children, fullWidth = false, className = "", isMobile = false, fullHeight = false, autoHeight = false, scrollable = true, ref }) => {
7
+ export const CardContainer = ({ id, size, children, fullWidth = false, className = "", isMobile = false, fullHeight = false, autoHeight = false, scrollable = true, noWidthConstraint = false, ref }) => {
8
8
  const isDesktop = !isMobile;
9
9
  const isAbsolute = isAbsoluteSize(size);
10
10
  const containerClassNames = useMemo(() => classNames([
@@ -15,8 +15,9 @@ export const CardContainer = ({ size, children, fullWidth = false, className = "
15
15
  fullHeight ? "zen-card-container--full-height" : "",
16
16
  autoHeight ? "zen-card-container--auto-height" : "",
17
17
  scrollable ? "zen-card-container--scrollable" : "",
18
+ noWidthConstraint ? "zen-card-container--no-width-constraint" : "",
18
19
  className
19
- ]), [size, fullWidth, className, isMobile, isDesktop, isAbsolute, fullHeight, autoHeight, scrollable]);
20
+ ]), [size, fullWidth, className, isMobile, isDesktop, isAbsolute, fullHeight, autoHeight, scrollable, noWidthConstraint]);
20
21
  const style = useAbsoluteSize(size, isMobile, autoHeight, fullWidth);
21
- return (_jsx("div", { ref: ref, style: style, className: containerClassNames, children: children }));
22
+ return (_jsx("div", { id: id, ref: ref, style: style, className: containerClassNames, children: children }));
22
23
  };
@@ -1,10 +1,12 @@
1
1
  const baseColors = [
2
- "#2853BD",
3
- "#DA7C3A",
4
- "#4AA75E",
5
- "#1098FF",
6
- "#3852D6",
7
- "#D35D80"
2
+ "#3CCDE5",
3
+ "#428AFF",
4
+ "#8256E5",
5
+ "#06C989",
6
+ "#F98C41",
7
+ "#F5BD60",
8
+ "#E56A6A",
9
+ "#8A94A2"
8
10
  ];
9
11
  export const getDefaultDatasetStyle = (dataSet, dsIndex) => {
10
12
  var _a, _b;
@@ -1,9 +1,11 @@
1
1
  const baseColors = [
2
- "#2853BD",
3
- "#DA7C3A",
4
- "#4AA75E",
5
- "#1098FF",
6
- "#3852D6",
7
- "#D35D80"
2
+ "#3CCDE5",
3
+ "#428AFF",
4
+ "#8256E5",
5
+ "#06C989",
6
+ "#F98C41",
7
+ "#F5BD60",
8
+ "#E56A6A",
9
+ "#8A94A2"
8
10
  ];
9
11
  export const getDatasetColor = (index) => baseColors[index % baseColors.length];
@@ -48,7 +48,7 @@ export const useSummary = (chartSummary, data) => {
48
48
  }
49
49
  return data.datasets[0] && typeof data.datasets[0].borderColor === "string"
50
50
  ? data.datasets[0].borderColor
51
- : (summary && summary.title) ? "#2853BD" : undefined;
51
+ : (summary && summary.title) ? "#3CCDE5" : undefined;
52
52
  }, [data.datasets, summary]);
53
53
  const title = useMemo(() => {
54
54
  if (summary && summary.title) {
@@ -1,10 +1,12 @@
1
1
  const baseColors = [
2
- "#2853BD",
3
- "#DA7C3A",
4
- "#4AA75E",
5
- "#1098FF",
6
- "#3852D6",
7
- "#D35D80"
2
+ "#3CCDE5",
3
+ "#428AFF",
4
+ "#8256E5",
5
+ "#06C989",
6
+ "#F98C41",
7
+ "#F5BD60",
8
+ "#E56A6A",
9
+ "#8A94A2"
8
10
  ];
9
11
  export const getDefaultDatasetStyle = (dataSet) => {
10
12
  const newDataSet = Object.assign({}, dataSet);
@@ -25,7 +25,7 @@ export function getInterpolatedValue(xScale, data, datasetIndex, xPixel) {
25
25
  upperXPixel = pointXPixel;
26
26
  }
27
27
  }
28
- if (!lowerPoint || !upperPoint) {
28
+ if (lowerPoint === undefined || upperPoint === undefined) {
29
29
  return null;
30
30
  }
31
31
  // Perform linear interpolation
@@ -65,13 +65,13 @@ export const LinePlugin = (containerId, options, isDark) => ({
65
65
  const yAxisID = dataset.yAxisID || "y";
66
66
  const yScale = chart.scales[yAxisID];
67
67
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
68
- if (value && yScale) {
68
+ if (value !== null && yScale) {
69
69
  const lowestDsY = yScale.getPixelForValue(value);
70
70
  if (lowestDsY < lowestValueY) {
71
71
  lowestValueY = lowestDsY;
72
72
  }
73
73
  }
74
- if (value && dataset.label) {
74
+ if (value !== null && dataset.label) {
75
75
  const label = dataset.label;
76
76
  const color = dataset.borderColor;
77
77
  const item = {
@@ -93,8 +93,20 @@ export const LinePlugin = (containerId, options, isDark) => ({
93
93
  const scrollableParent = getScrollableParent(chart.canvas);
94
94
  const scrollTop = scrollableParent ? scrollableParent.scrollTop : 0;
95
95
  const scrollLeft = scrollableParent ? scrollableParent.scrollLeft : 0;
96
- const xValue = chart.scales.x.getValueForPixel(x);
97
- const xLabel = xValue ? chart.scales.x.getLabelForValue(xValue) : undefined;
96
+ let elementIdx = undefined;
97
+ const elementIds = new Set(chart.getActiveElements().map(el => el.index));
98
+ if (elementIds.size === 1) {
99
+ elementIdx = [...elementIds][0];
100
+ }
101
+ let xLabel;
102
+ const scaleLabels = chart.scales.x.getLabels();
103
+ if (elementIdx !== undefined && elementIdx < scaleLabels.length) {
104
+ xLabel = scaleLabels[elementIdx];
105
+ }
106
+ else {
107
+ const xValue = chart.scales.x.getValueForPixel(x);
108
+ xLabel = xValue ? chart.scales.x.getLabelForValue(xValue) : undefined;
109
+ }
98
110
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
99
111
  renderTooltip(containerId, left + scrollLeft, top + scrollTop, "top", items, options === null || options === void 0 ? void 0 : options.title, options && options.subtitle !== undefined ? options.subtitle : xLabel, (options === null || options === void 0 ? void 0 : options.note) || undefined, isDark);
100
112
  }
@@ -5,6 +5,9 @@ import { useKeydown } from "./useKeydown";
5
5
  export const useEscape = (containerRef, callback, subscriptionTrigger, condition) => {
6
6
  const handleKeyDown = useCallback((e) => {
7
7
  if (e.key === "Escape") {
8
+ if (e.defaultPrevented) {
9
+ return;
10
+ }
8
11
  const target = e.target;
9
12
  if (!target || !containerRef.current) {
10
13
  return;
@@ -13,6 +16,7 @@ export const useEscape = (containerRef, callback, subscriptionTrigger, condition
13
16
  const focusable = containerRef.current.querySelectorAll(FOCUSABLE_SELECTOR);
14
17
  if (isPopupFocused || !focusable.length) {
15
18
  callback(e);
19
+ e.preventDefault();
16
20
  return;
17
21
  }
18
22
  }
@@ -4,8 +4,9 @@ import { IPillNonActionable } from "../../pill/interfaces/pillNonActionable.inte
4
4
  interface IPillSize extends Pick<IPill, "size">, Pick<IPillNonActionable, "onClose"> {
5
5
  iconPosition?: "left" | "right";
6
6
  hasContent?: boolean;
7
+ initialTitle?: string;
7
8
  }
8
- export declare const usePillSize: ({ size, iconPosition, onClose, hasContent }: IPillSize) => {
9
+ export declare const usePillSize: ({ size, iconPosition, onClose, hasContent, initialTitle }: IPillSize) => {
9
10
  contentClasses: string;
10
11
  ref: import("react").RefObject<HTMLElement | null>;
11
12
  title: string;
@@ -3,13 +3,13 @@ import { classNames } from "../classNames/classNames";
3
3
  import { useResize } from "./useResize";
4
4
  import { useDriveClassName } from "../../utils/theme/useDriveClassName";
5
5
  const PILL_WIDTH_WITHOUT_CONTENT = 64;
6
- export const usePillSize = ({ size, iconPosition, onClose, hasContent }) => {
6
+ export const usePillSize = ({ size, iconPosition, onClose, hasContent, initialTitle }) => {
7
7
  const isFixedSize = size && size !== "default" && size !== "fullWidth";
8
8
  const hasIcon = !!iconPosition;
9
9
  const isClosable = !!onClose;
10
10
  const [isContentHidden, setIsContentHidden] = useState(false);
11
11
  const ref = useRef(null);
12
- const [title, setTitle] = useState("");
12
+ const [title, setTitle] = useState(initialTitle || "");
13
13
  const driveClass = useDriveClassName("zen-pill-new-content");
14
14
  const contentClasses = classNames([
15
15
  "zen-pill-new-content",
@@ -38,6 +38,9 @@ export const usePillSize = ({ size, iconPosition, onClose, hasContent }) => {
38
38
  hidePillContent();
39
39
  }, true);
40
40
  useLayoutEffect(() => {
41
+ if (initialTitle) {
42
+ return;
43
+ }
41
44
  if (ref.current) {
42
45
  setTitle(ref.current.textContent || "");
43
46
  }
@@ -45,6 +48,6 @@ export const usePillSize = ({ size, iconPosition, onClose, hasContent }) => {
45
48
  return;
46
49
  }
47
50
  hidePillContent();
48
- }, [hidePillContent, isFixedSize, isClosable, hasIcon]);
51
+ }, [hidePillContent, isFixedSize, isClosable, hasIcon, initialTitle]);
49
52
  return { contentClasses, ref, title, isFixedSize, isTextContentHidden: isContentHidden && isClosable && hasIcon };
50
53
  };
@@ -35,4 +35,10 @@ export declare const Colors: {
35
35
  variable: string;
36
36
  description: string;
37
37
  }[];
38
+ Categorical: {
39
+ colorName: string;
40
+ text: string;
41
+ variable: string;
42
+ description: string;
43
+ }[];
38
44
  };
@@ -304,5 +304,55 @@ export const Colors = {
304
304
  variable: "--duty-status-exemption",
305
305
  description: "To indicate an exemption "
306
306
  }
307
+ ],
308
+ Categorical: [
309
+ {
310
+ colorName: "categorical-light-blue",
311
+ text: "Light blue",
312
+ variable: "--data--categorical-light-blue",
313
+ description: "This color is the first color in the categorical color set."
314
+ },
315
+ {
316
+ colorName: "categorical-blue",
317
+ text: "Blue",
318
+ variable: "--data--categorical-blue",
319
+ description: "This color is the second color in the categorical color set."
320
+ },
321
+ {
322
+ colorName: "categorical-purple",
323
+ text: "Purple",
324
+ variable: "--data--categorical-purple",
325
+ description: "This color is the third color in the categorical color set."
326
+ },
327
+ {
328
+ colorName: "categorical-green",
329
+ text: "Green",
330
+ variable: "--data--categorical-green",
331
+ description: "This color is the fourth color in the categorical color set."
332
+ },
333
+ {
334
+ colorName: "categorical-orange",
335
+ text: "Orange",
336
+ variable: "--data--categorical-orange",
337
+ description: "This color is the fifth color in the categorical color set."
338
+ },
339
+ {
340
+ colorName: "categorical-yellow",
341
+ text: "Yellow",
342
+ variable: "--data--categorical-yellow",
343
+ description: "This color is the sixth color in the categorical color set."
344
+ },
345
+ {
346
+ colorName: "categorical-red",
347
+ text: "Red",
348
+ variable: "--data--categorical-red",
349
+ description: "This color is the seventh color in the categorical color set."
350
+ },
351
+ {
352
+ colorName: "categorical-grey",
353
+ text: "Grey",
354
+ variable: "--data--categorical-grey",
355
+ description: "This color is the eighth color in the categorical color set."
356
+ }
307
357
  ]
308
358
  };
@@ -26,10 +26,11 @@ export interface IDataFeed<T, N = T> extends IDataGrid<T, N> {
26
26
  expandedRows?: string[];
27
27
  onExpandedChange?: (id: string, isExpanded: boolean) => void;
28
28
  activePage?: number;
29
+ onClick?: (id: string) => void;
29
30
  }
30
31
  declare const EmptyList: FC<PropsWithChildren>;
31
32
  declare const Footer: FC<PropsWithChildren>;
32
- declare const DataFeedInner: <T extends IRowEntity<N>, N extends IEntityWithId>({ entities, columns, feedWrappers, className, expanded, options, description, children, actions, actionsAsync, primaryActions, itemsPerPage, rowClassName, expandedRows, onExpandedChange, activePage }: IDataFeed<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
33
+ declare const DataFeedInner: <T extends IRowEntity<N>, N extends IEntityWithId>({ entities, columns, feedWrappers, className, expanded, options, description, children, actions, actionsAsync, primaryActions, itemsPerPage, rowClassName, expandedRows, onExpandedChange, activePage, onClick }: IDataFeed<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
33
34
  export interface IDataFeedStaticProps {
34
35
  EmptyList: typeof EmptyList;
35
36
  Footer: typeof Footer;
@@ -19,7 +19,7 @@ const checkCloseToTheEnd = (feedContainerElt) => {
19
19
  return distanceToTheBottom < endOfFeedThreshold;
20
20
  };
21
21
  const FIRST_RENDERED_ROWS = 50;
22
- const DataFeedInner = ({ entities, columns, feedWrappers, className, expanded, options, description, children, actions, actionsAsync, primaryActions, itemsPerPage = 1000, rowClassName, expandedRows, onExpandedChange, activePage }, ref) => {
22
+ const DataFeedInner = ({ entities, columns, feedWrappers, className, expanded, options, description, children, actions, actionsAsync, primaryActions, itemsPerPage = 1000, rowClassName, expandedRows, onExpandedChange, activePage, onClick }, ref) => {
23
23
  const [pages, setPages] = useState(1);
24
24
  const data = useMemo(() => entities.slice(0, itemsPerPage * pages), [entities, itemsPerPage, pages]);
25
25
  const initialVisibleRows = useMemo(() => data.slice(0, FIRST_RENDERED_ROWS).map(r => r.id), [data]);
@@ -91,8 +91,23 @@ const DataFeedInner = ({ entities, columns, feedWrappers, className, expanded, o
91
91
  }, true);
92
92
  const feedItems = useMemo(() => data.map((entity, index) => {
93
93
  const entityClassName = getRowClassName(rowClassName, entity);
94
- return _jsx(FeedItem, { collapsedColumnsQty: collapsedColumnsQty, columnsList: columnsList, feedWrappers: feedWrappers || [], visibleColumns: visibleColumns, entity: entity, visibleRows: visibleRows, index: index, expanded: expanded, className: entityClassName, actions: actions, actionsAsync: actionsAsync, primaryActions: primaryActions, isRowExpanded: expandedRows && expandedRows.indexOf(entity.id) > -1, onExpandedChange: (isExpanded) => onExpandedChange && onExpandedChange(entity.id, isExpanded) }, entity.id);
95
- }), [data, rowClassName, collapsedColumnsQty, columnsList, feedWrappers, visibleColumns, visibleRows, expanded, actions, actionsAsync, primaryActions, expandedRows, onExpandedChange]);
94
+ return _jsx(FeedItem, { collapsedColumnsQty: collapsedColumnsQty, columnsList: columnsList, feedWrappers: feedWrappers || [], visibleColumns: visibleColumns, entity: entity, visibleRows: visibleRows, index: index, expanded: expanded, className: entityClassName, actions: actions, actionsAsync: actionsAsync, primaryActions: primaryActions, isRowExpanded: expandedRows && expandedRows.indexOf(entity.id) > -1, onExpandedChange: (isExpanded) => onExpandedChange && onExpandedChange(entity.id, isExpanded), onClick: onClick }, entity.id);
95
+ }), [
96
+ data,
97
+ rowClassName,
98
+ collapsedColumnsQty,
99
+ columnsList,
100
+ feedWrappers,
101
+ visibleColumns,
102
+ visibleRows,
103
+ expanded,
104
+ actions,
105
+ actionsAsync,
106
+ primaryActions,
107
+ expandedRows,
108
+ onExpandedChange,
109
+ onClick
110
+ ]);
96
111
  return _jsx("div", { className: "zen-data-grid-wrapper", children: _jsxs("div", { className: classNames([
97
112
  "zen-data-grid",
98
113
  className || ""
@@ -23,6 +23,7 @@ interface IFeedItem<T extends IRowEntity<N>, N extends IEntityWithId> {
23
23
  actions?: IActionWithId<T> | ((entity: T, isNested: boolean) => React.JSX.Element);
24
24
  actionsAsync?: IActionWithId<T> | ((entity: T, isNested: boolean) => PromiseLike<React.JSX.Element>);
25
25
  primaryActions?: IActionWithId<T>[] | ((e: T, isNested: boolean) => IActionWithId<T>[]);
26
+ onClick?: (id: string) => void;
26
27
  }
27
- export declare const FeedItem: <T extends IRowEntity<N>, N extends IEntityWithId>({ columnsList, feedWrappers, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className, isRowExpanded, onExpandedChange, actions, actionsAsync, primaryActions }: IFeedItem<T, N>) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const FeedItem: <T extends IRowEntity<N>, N extends IEntityWithId>({ columnsList, feedWrappers, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className, isRowExpanded, onExpandedChange, actions, actionsAsync, primaryActions, onClick }: IFeedItem<T, N>) => import("react/jsx-runtime").JSX.Element;
28
29
  export {};
@@ -13,7 +13,7 @@ const getIconFromColumnComponent = (column, entity, isNested) => {
13
13
  }
14
14
  return null;
15
15
  };
16
- const FeedItemInner = ({ columnsList, feedWrappers, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className = "", isRowExpanded, onExpandedChange, actions, actionsAsync, primaryActions }) => {
16
+ const FeedItemInner = ({ columnsList, feedWrappers, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className = "", isRowExpanded, onExpandedChange, actions, actionsAsync, primaryActions, onClick }) => {
17
17
  const { mainColumns, secondaryColumns } = useVisibleColumns(columnsList, expanded, { visibleColumns, collapsedColumnsQty });
18
18
  const mainColumnsMemoized = useMemo(() => mainColumns, [mainColumns]);
19
19
  const secondaryColumnsMemoized = useMemo(() => secondaryColumns, [secondaryColumns]);
@@ -97,15 +97,17 @@ const FeedItemInner = ({ columnsList, feedWrappers, expanded, collapsedColumnsQt
97
97
  const feedPlaceholder = getFeedPlaceholder(column);
98
98
  return _jsx(DataFeedCell, { limited: false, visibleOnHover: false, isVisible: isVisible, title: column.title, render: renderFeed, renderWrappers: renderWrappers, renderPlaceholder: feedPlaceholder, defaultValue: column.meta.defaultValue, entity: rowEntity, isNested: !nested }, `${entity.id}-${column.id}`);
99
99
  });
100
- const onItemClick = nested && onExpandedChange
100
+ const onItemClick = nested && nested.length > 0 && onExpandedChange
101
101
  ? () => onExpandedChange(!isRowExpanded)
102
- : undefined;
102
+ : onClick
103
+ ? () => onClick(entity.id)
104
+ : undefined;
103
105
  const icon = getIconFromColumnComponent(mainColumnsMemoized[0], rowEntity, !nested);
104
106
  const actionsNode = getActions();
105
107
  const renderFeedWrappers = getRenderFeedWrappers(feedWrappers, rowEntity, !nested);
106
108
  const key = !nested ? `nested_${rowEntity.id}` : rowEntity.id;
107
109
  return _jsx(DataFeedItem, { id: entity.id, index: index, onClick: onItemClick, className: className, icon: icon, identifier: mainColumnsData[0], primaryData: mainColumnsData.slice(1), secondaryData: secondaryColumnsData, actions: actionsNode, nestedData: nested && nested.length ? nested : undefined, renderFeedWrappers: renderFeedWrappers }, key);
108
- }, [className, feedWrappers, index, isRowExpanded, isVisible, mainColumnsMemoized, onExpandedChange, secondaryColumnsMemoized, actions, actionsAsync, primaryActions, entity]);
110
+ }, [className, feedWrappers, index, isRowExpanded, isVisible, mainColumnsMemoized, onExpandedChange, secondaryColumnsMemoized, actions, actionsAsync, primaryActions, entity, onClick]);
109
111
  const nestedCells = useMemo(() => (entity.children && isRowExpanded ? entity.children : []).map(nestedEntity => renderCells(nestedEntity)), [entity.children, isRowExpanded, renderCells]);
110
112
  const cells = useMemo(() => renderCells(entity, nestedCells), [entity, nestedCells, renderCells]);
111
113
  return cells;
@@ -15,5 +15,6 @@ export interface IDataGridCell<T extends IEntityWithId> extends IZenComponentPro
15
15
  width?: number;
16
16
  colspan?: number;
17
17
  onClick?: () => void;
18
+ isActive?: boolean;
18
19
  }
19
- export declare const DataGridCell: <T extends IEntityWithId>({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick }: IDataGridCell<T>) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const DataGridCell: <T extends IEntityWithId>({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }: IDataGridCell<T>) => import("react/jsx-runtime").JSX.Element;
@@ -3,7 +3,7 @@ import { memo, useCallback, useEffect, useState } from "react";
3
3
  import { classNames } from "../../commonHelpers/classNames/classNames";
4
4
  import { isPromiseLike } from "../columns/basicColumn";
5
5
  import { isActiveElement } from "../../list/utils/isActiveElement";
6
- const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick }) => {
6
+ const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }) => {
7
7
  const [content, setContent] = useState("");
8
8
  const placeholderRenderer = useCallback(() => {
9
9
  const renderFn = renderPlaceholder || (() => "...");
@@ -56,6 +56,7 @@ const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, render
56
56
  }, [onClick]);
57
57
  return _jsx("td", { colSpan: colspan, onClick: onCellClick, className: classNames([
58
58
  "zen-data-grid__row-cell",
59
+ isActive ? "zen-data-grid__row-cell--active" : "",
59
60
  className || "",
60
61
  index === 0 ? "zen-data-grid__row-cell--first" : "",
61
62
  visibleOnHover ? "zen-data-grid__row-cell--visible-on-hover" : "",
@@ -15,6 +15,8 @@ export interface IDataGrid<T, N = T> extends Omit<IZenComponentProps, "children"
15
15
  rowClassName?: TRowClassName<T>;
16
16
  expandedRows?: string[];
17
17
  onExpandedChange?: (id: string, isExpanded: boolean) => void;
18
+ active?: string | undefined;
19
+ onClick?: (id: string) => void;
18
20
  }
19
21
  export declare const NOT_INTERACTIVE_MODIFIER = "zen-data-grid--not-interactive";
20
22
  export declare const DRAGGING_MODIFIER = "zen-data-grid--dragging";
@@ -23,7 +25,7 @@ export declare const VERTICAL_SCROLL_MODIFIER = "zen-data-grid--vertical-scroll"
23
25
  export declare const MIN_CELL_WIDTH = 100;
24
26
  export declare const EmptyList: FC<PropsWithChildren>;
25
27
  export declare const Footer: FC<PropsWithChildren>;
26
- declare const DataGridInner: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ entities, columns, className, description, emptyCellTitle, children, rowClassName, expandedRows, onExpandedChange }: IDataGrid<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
28
+ declare const DataGridInner: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ entities, columns, className, description, emptyCellTitle, children, rowClassName, expandedRows, onExpandedChange, active, onClick }: IDataGrid<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
27
29
  export interface IDataGridStaticProps {
28
30
  EmptyList: typeof EmptyList;
29
31
  Footer: typeof Footer;
@@ -63,7 +63,9 @@ const DataGridInner = ({
63
63
  children,
64
64
  rowClassName,
65
65
  expandedRows,
66
- onExpandedChange
66
+ onExpandedChange,
67
+ active,
68
+ onClick
67
69
  }, ref) => {
68
70
  const {
69
71
  translate
@@ -204,10 +206,12 @@ const DataGridInner = ({
204
206
  className: getRowClassName(rowClassName, entity),
205
207
  expanded: expandedRows && expandedRows.indexOf(entity.id) > -1,
206
208
  onExpandedChange: entity.children && entity.children.length > 0 ? isExpanded => onExpandedChange && onExpandedChange(entity.id, isExpanded) : undefined,
209
+ isActive: active === entity.id,
210
+ onClick: onClick,
207
211
  isTreeGrid: isTreeGrid,
208
212
  ariaPosinset: entityIndex + 1,
209
213
  ariaSetsize: total
210
- }, entity.id), [columnsList, expandedRows, flexibleColumnWidth, onExpandedChange, rowClassName, visibleRows, isTreeGrid]);
214
+ }, entity.id), [columnsList, expandedRows, flexibleColumnWidth, onExpandedChange, rowClassName, visibleRows, isTreeGrid, active, onClick]);
211
215
  const body = useMemo(() => entities.map((entity, entityIndex) => renderRow(entity, entityIndex, entities.length)), [entities, renderRow]);
212
216
  const headerContent = useMemo(() => columnsList.map((column, index) => renderHeaderCell(column, index)), [columnsList, renderHeaderCell]);
213
217
  useResize(() => {
@@ -220,6 +224,7 @@ const DataGridInner = ({
220
224
  className: gridClasses,
221
225
  ref: gridRef,
222
226
  onScroll: handleScroll,
227
+ tabIndex: 0,
223
228
  children: [_jsxs("table", {
224
229
  className: "zen-data-grid__table",
225
230
  "aria-label": description,
@@ -15,6 +15,8 @@ export interface IDataGridRow<T extends IRowEntity<N>, N extends IEntityWithId>
15
15
  isTreeGrid: boolean;
16
16
  ariaPosinset: number;
17
17
  ariaSetsize: number;
18
+ isActive?: boolean;
19
+ onClick?: (id: string) => void;
18
20
  }
19
21
  export declare const MIN_CELL_WIDTH = 100;
20
- export declare const DataGridRow: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize }: IDataGridRow<T, N>) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const DataGridRow: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize, onClick, isActive }: IDataGridRow<T, N>) => import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,7 @@ import { classNames } from "../../commonHelpers/classNames/classNames";
4
4
  import { DataGridCell } from "../cell/cell";
5
5
  export const MIN_CELL_WIDTH = 100;
6
6
  const getColumnWidth = (defaultWidth) => Math.floor(Math.max(defaultWidth, MIN_CELL_WIDTH));
7
- const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize }) => {
7
+ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize, onClick, isActive }) => {
8
8
  const isVisible = visibleRows.has(entity.id);
9
9
  const listOfDefaultWidthColumns = useMemo(() => columns.map(column => column.meta.defaultWidth), [columns]);
10
10
  const getColWidth = useCallback((columnIndex, colspan) => {
@@ -53,9 +53,9 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
53
53
  ? column.columnComponent.renderNested.bind(column.columnComponent)
54
54
  : column.columnComponent.render.bind(column.columnComponent))
55
55
  : column.columnComponent.render.bind(column.columnComponent);
56
- acc.cells.push(_jsx(DataGridCell, { render: (e) => renderFn(e, isNested), renderPlaceholder: column.meta.renderPlaceholder, renderWrappers: renderWrappers, defaultValue: column.meta.defaultValue, entity: rowEntity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width, isVisible: isVisible, colspan: colspan, onClick: !isNested && onExpandedChange ? () => onExpandedChange(!expanded) : undefined, className: isNested ? "zen-data-grid__row-cell--nested" : "" }, `${rowEntity.id}_${column.name}`));
56
+ acc.cells.push(_jsx(DataGridCell, { render: (e) => renderFn(e, isNested), renderPlaceholder: column.meta.renderPlaceholder, renderWrappers: renderWrappers, defaultValue: column.meta.defaultValue, entity: rowEntity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width, isVisible: isVisible, colspan: colspan, onClick: !isNested && onExpandedChange ? () => onExpandedChange(!expanded) : (onClick ? () => onClick(rowEntity.id) : undefined), isActive: isActive, className: isNested ? "zen-data-grid__row-cell--nested" : "" }, `${rowEntity.id}_${column.name}`));
57
57
  return acc;
58
- }, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange]);
58
+ }, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange, isActive, onClick]);
59
59
  const cells = useMemo(() => renderCells(entity, false), [entity, renderCells]);
60
60
  const nestedCells = useMemo(() => (expanded && entity.children ? entity.children : []).map((nestedEntity) => renderCells(nestedEntity, true)), [entity.children, expanded, renderCells]);
61
61
  return _jsxs(_Fragment, { children: [_jsx("tr", { "data-row-id": id, id: mainRowId, role: "row", "aria-level": isTreeGrid ? 1 : undefined, "aria-posinset": isTreeGrid ? ariaPosinset : undefined, "aria-setsize": isTreeGrid ? ariaSetsize : undefined, "aria-expanded": isTreeGrid ? expanded : undefined, className: classNames([