@rio-cloud/rio-uikit 2.3.0-beta.3 → 2.3.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 (83) hide show
  1. package/Table.js +10 -9
  2. package/TableNext.js +10 -9
  3. package/TableRowActionsDropdown.d.ts +2 -0
  4. package/TableRowActionsDropdown.js +5 -0
  5. package/TableRowActionsDropdown.js.map +1 -0
  6. package/components/dropdown/ButtonDropdown.d.ts +4 -0
  7. package/components/dropdown/ButtonDropdown.js +82 -80
  8. package/components/dropdown/ButtonDropdown.js.map +1 -1
  9. package/components/map/components/Map.js +199 -180
  10. package/components/map/components/Map.js.map +1 -1
  11. package/components/map/components/MapContext.d.ts +2 -0
  12. package/components/map/components/MapContext.js +6 -4
  13. package/components/map/components/MapContext.js.map +1 -1
  14. package/components/map/components/features/MapZoom.js +19 -19
  15. package/components/map/components/features/MapZoom.js.map +1 -1
  16. package/components/map/utils/mapTypes.d.ts +6 -0
  17. package/components/map/utils/mapTypes.js.map +1 -1
  18. package/components/map/utils/mapUtils.d.ts +2 -0
  19. package/components/map/utils/mapUtils.js +4 -0
  20. package/components/map/utils/mapUtils.js.map +1 -1
  21. package/components/table/Table.d.ts +3 -1
  22. package/components/table/Table.js +225 -205
  23. package/components/table/Table.js.map +1 -1
  24. package/components/table/Table.types.d.ts +49 -0
  25. package/components/table/TableExpandedRow.d.ts +4 -0
  26. package/components/table/TableExpandedRow.js +69 -66
  27. package/components/table/TableExpandedRow.js.map +1 -1
  28. package/components/table/TableGroupRow.d.ts +3 -1
  29. package/components/table/TableGroupRow.js +15 -14
  30. package/components/table/TableGroupRow.js.map +1 -1
  31. package/components/table/TableHeader.d.ts +1 -9
  32. package/components/table/TableHeader.js +83 -67
  33. package/components/table/TableHeader.js.map +1 -1
  34. package/components/table/TableRow.d.ts +7 -1
  35. package/components/table/TableRow.js +75 -72
  36. package/components/table/TableRow.js.map +1 -1
  37. package/components/table/TableRowActionsDropdown.d.ts +11 -0
  38. package/components/table/TableRowActionsDropdown.js +22 -0
  39. package/components/table/TableRowActionsDropdown.js.map +1 -0
  40. package/components/table/TableStickyRowButton.d.ts +25 -0
  41. package/components/table/TableStickyRowButton.js +32 -0
  42. package/components/table/TableStickyRowButton.js.map +1 -0
  43. package/components/table/TableToolbar.d.ts +24 -3
  44. package/components/table/TableToolbar.js +78 -37
  45. package/components/table/TableToolbar.js.map +1 -1
  46. package/components/table/TableViewToggles.js +5 -5
  47. package/components/table/TableViewToggles.js.map +1 -1
  48. package/components/table/context/TableInteractionContext.d.ts +3 -0
  49. package/components/table/context/TableInteractionContext.js.map +1 -1
  50. package/components/table/context/TableRenderContext.d.ts +1 -0
  51. package/components/table/context/TableRenderContext.js.map +1 -1
  52. package/components/table/layout/useMeasuredColumnMaxWidths.js +52 -54
  53. package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -1
  54. package/components/table/layout/useTableLayout.d.ts +4 -1
  55. package/components/table/layout/useTableLayout.js +54 -48
  56. package/components/table/layout/useTableLayout.js.map +1 -1
  57. package/components/table/layout/useTableVirtualization.js +51 -56
  58. package/components/table/layout/useTableVirtualization.js.map +1 -1
  59. package/components/table/model/resolveResponsiveViewType.d.ts +2 -0
  60. package/components/table/model/resolveResponsiveViewType.js +27 -0
  61. package/components/table/model/resolveResponsiveViewType.js.map +1 -0
  62. package/components/table/render/header/TableHeaderSelectionCell.d.ts +1 -0
  63. package/components/table/render/header/TableHeaderSelectionCell.js +13 -12
  64. package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -1
  65. package/components/table/runtime/useResponsiveResolvedViewType.d.ts +23 -0
  66. package/components/table/runtime/useResponsiveResolvedViewType.js +22 -0
  67. package/components/table/runtime/useResponsiveResolvedViewType.js.map +1 -0
  68. package/components/table/selection/useInternalTableSelectionState.d.ts +2 -0
  69. package/components/table/selection/useInternalTableSelectionState.js +27 -17
  70. package/components/table/selection/useInternalTableSelectionState.js.map +1 -1
  71. package/components/table/selection/useTableSelection.d.ts +5 -1
  72. package/components/table/selection/useTableSelection.js +37 -26
  73. package/components/table/selection/useTableSelection.js.map +1 -1
  74. package/components/table/shared/parsePixelSize.d.ts +2 -0
  75. package/components/table/shared/parsePixelSize.js +13 -0
  76. package/components/table/shared/parsePixelSize.js.map +1 -0
  77. package/hooks/useResizeObserver.d.ts +25 -6
  78. package/hooks/useResizeObserver.js +20 -18
  79. package/hooks/useResizeObserver.js.map +1 -1
  80. package/package.json +10 -10
  81. package/version.d.ts +1 -1
  82. package/version.js +2 -2
  83. package/version.js.map +1 -1
@@ -7,6 +7,7 @@ export type TableViewType = 'TABLE' | 'SINGLE_CARD' | 'MULTI_CARDS';
7
7
  export type TableSortDirection = 'asc' | 'desc';
8
8
  export type TableRowId = string | number;
9
9
  export type TableRowData = Record<string, unknown>;
10
+ export type TableStickyReference = 'applicationLayout' | 'container';
10
11
  export type TableCardsStyleSettings = {
11
12
  /**
12
13
  * Minimum card width for `MULTI_CARDS` view.
@@ -33,6 +34,16 @@ export type TableCardsStyleSettings = {
33
34
  */
34
35
  contentClassName?: string;
35
36
  };
37
+ export type TableResponsiveBreakpoint = {
38
+ /**
39
+ * Switch to `MULTI_CARDS` below this rendered table width.
40
+ */
41
+ cards?: number | string;
42
+ /**
43
+ * Switch to `SINGLE_CARD` below this rendered table width.
44
+ */
45
+ list?: number | string;
46
+ };
36
47
  /**
37
48
  * High-level animation settings for expanded table rows.
38
49
  *
@@ -170,6 +181,7 @@ export type TableColumn<RowType extends TableRowData> = TableColumnDefinition<Ro
170
181
  export type TableRowClassName<RowType extends TableRowData> = string | ((row: RowType, rowIndex: number) => string);
171
182
  export type TableCellClassName<RowType extends TableRowData> = (row: RowType, column: TableColumnDefinition<RowType>, rowIndex: number, columnIndex: number) => string;
172
183
  export type TableRowAnimationProps<RowType extends TableRowData> = MotionProps | ((row: RowType, rowIndex: number) => MotionProps);
184
+ export type TableRowSelectable<RowType extends TableRowData> = (row: RowType, rowIndex: number) => boolean;
173
185
  export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLDivElement>, 'draggable' | 'onClick'> & {
174
186
  /**
175
187
  * Row key accessor for resolving a stable unique row id.
@@ -192,6 +204,24 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
192
204
  * Card width configuration for `MULTI_CARDS` view.
193
205
  */
194
206
  cardsStyle?: TableCardsStyleSettings;
207
+ /**
208
+ * Automatically switches `TABLE` view when the rendered table width changes.
209
+ *
210
+ * Use `cards` to switch to `MULTI_CARDS` and `list` to switch to `SINGLE_CARD`.
211
+ * The object may contain either key or both.
212
+ *
213
+ * Accepts pixel numbers or CSS length values such as `720`, `'720px'`, or `'50vw'`.
214
+ */
215
+ responsiveBreakpoint?: TableResponsiveBreakpoint;
216
+ /**
217
+ * Called whenever the effective rendered view changes after applying responsive breakpoint logic.
218
+ *
219
+ * This can differ from `viewType` when `responsiveBreakpoint` forces an automatic switch.
220
+ * In controlled setups, you can use this callback to keep the external `viewType` state in sync.
221
+ *
222
+ * Only used when `responsiveBreakpoint` is provided.
223
+ */
224
+ onViewTypeChange?: (viewType: TableViewType) => void;
195
225
  /**
196
226
  * Compact row/cell spacing like old `table-condensed`.
197
227
  *
@@ -255,6 +285,17 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
255
285
  * @default '1px'
256
286
  */
257
287
  rowSeparatorWidth?: number | string;
288
+ /**
289
+ * Controls which scroll context sticky headers and sticky rows align to in `TABLE` view.
290
+ *
291
+ * Use `applicationLayout` when the page scroll happens in the default app body.
292
+ * Use `container` when the table sits inside its own explicit overflow container.
293
+ *
294
+ * Sticky rows inside `TableBody maxHeight` continue to pin within that internal body scroller.
295
+ *
296
+ * @default 'applicationLayout'
297
+ */
298
+ stickyReference?: TableStickyReference;
258
299
  /**
259
300
  * Sticky column behavior in `TABLE` view.
260
301
  *
@@ -324,6 +365,14 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
324
365
  * Called when checkbox selection changes.
325
366
  */
326
367
  onSelectionChange?: (rowIds: TableRowId[]) => void;
368
+ /**
369
+ * Hides selection checkboxes for rows marked with `selectable={false}`.
370
+ *
371
+ * Those rows stay interactive for hover, click handling, and active-row state.
372
+ *
373
+ * @default false
374
+ */
375
+ hideSelectionCheckboxesForExcludedRows?: boolean;
327
376
  /**
328
377
  * Currently selected row keys for multi-selection use cases.
329
378
  */
@@ -9,6 +9,10 @@ export type TableExpandedRowProps<RowType extends TableRowData> = TableHtmlAttri
9
9
  * Optional class names only for this expanded row.
10
10
  */
11
11
  className?: string;
12
+ /**
13
+ * Excludes this row from table selection while keeping the row interactive.
14
+ */
15
+ selectable?: boolean;
12
16
  /**
13
17
  * Disable table hover styling for this row.
14
18
  */
@@ -1,41 +1,41 @@
1
- import { jsx as s, jsxs as _, Fragment as M } from "react/jsx-runtime";
2
- import { useReducedMotion as j, motion as B } from "motion/react";
3
- import { useRef as F, useState as H, useMemo as U } from "react";
4
- import L from "../checkbox/Checkbox.js";
5
- import A from "../../utils/classNames.js";
6
- import { resolveRowKey as W, resolveRowClassName as X } from "./model/resolveRowMeta.js";
7
- import { useOptionalTableInteractionContext as q } from "./context/TableInteractionContext.js";
8
- import { useOptionalTableRenderConfigContext as z } from "./context/TableRenderConfigContext.js";
9
- import { useOptionalTableSection as G, useTableBodyContext as J, extractTableHtmlAttributes as I, TableRowContext as Q } from "./context/TableStructureContext.js";
10
- import { useOptionalTableRenderContext as Y } from "./context/TableRenderContext.js";
11
- import { getInteractiveRowProps as Z } from "./shared/getInteractiveRowProps.js";
12
- const u = 0.18, $ = (C) => {
13
- const { isSelected: b, isTableView: m, onToggleSelection: R, cardCellClassName: x } = C;
1
+ import { jsx as s, jsxs as M, Fragment as j } from "react/jsx-runtime";
2
+ import { useReducedMotion as B, motion as H } from "motion/react";
3
+ import { useRef as U, useState as L, useMemo as W } from "react";
4
+ import X from "../checkbox/Checkbox.js";
5
+ import P from "../../utils/classNames.js";
6
+ import { resolveRowKey as q, resolveRowClassName as z } from "./model/resolveRowMeta.js";
7
+ import { useOptionalTableInteractionContext as G } from "./context/TableInteractionContext.js";
8
+ import { useOptionalTableRenderConfigContext as J } from "./context/TableRenderConfigContext.js";
9
+ import { useOptionalTableSection as Q, useTableBodyContext as Y, extractTableHtmlAttributes as A, TableRowContext as Z } from "./context/TableStructureContext.js";
10
+ import { useOptionalTableRenderContext as $ } from "./context/TableRenderContext.js";
11
+ import { getInteractiveRowProps as ee } from "./shared/getInteractiveRowProps.js";
12
+ const p = 0.18, oe = (b) => {
13
+ const { isSelected: C, isSelectable: u, hideSelectionControl: R, isTableView: x, onToggleSelection: h, cardCellClassName: r } = b;
14
14
  return /* @__PURE__ */ s(
15
15
  "div",
16
16
  {
17
- className: A("table-cell table-selection-cell", !m && x),
17
+ className: P("table-cell table-selection-cell", !x && r),
18
18
  role: "cell",
19
19
  "aria-colindex": 1,
20
- style: m ? { gridColumn: "1 / span 1", gridRow: "1 / span 1" } : void 0,
21
- onClick: (a) => a.stopPropagation(),
22
- onKeyDown: (a) => a.stopPropagation(),
23
- children: /* @__PURE__ */ s("div", { className: "table-selection-control", children: /* @__PURE__ */ s(L, { checked: b, onChange: R }) })
20
+ style: x ? { gridColumn: "1 / span 1", gridRow: "1 / span 1" } : void 0,
21
+ onClick: (e) => e.stopPropagation(),
22
+ onKeyDown: (e) => e.stopPropagation(),
23
+ children: !R && /* @__PURE__ */ s("div", { className: "table-selection-control", children: /* @__PURE__ */ s(X, { checked: C, disabled: !u, onChange: h }) })
24
24
  }
25
25
  );
26
- }, me = (C) => {
27
- const { children: b, className: m, noHover: R, parentKey: x, ...a } = C, e = z(), l = Y(), o = q(), P = G(), g = J(), w = F(0);
28
- w.current = 0;
29
- const [S, y] = H(!0), f = j(), D = U(
30
- () => f ? {
26
+ }, pe = (b) => {
27
+ const { children: C, className: u, noHover: R, parentKey: x, selectable: h, ...r } = b, e = J(), l = $(), o = G(), k = Q(), y = Y(), m = U(0);
28
+ m.current = 0;
29
+ const [D, f] = L(!0), v = B(), O = W(
30
+ () => v ? {
31
31
  initial: { opacity: 0 },
32
32
  animate: {
33
33
  opacity: 1,
34
- transition: { duration: u, ease: "easeInOut" }
34
+ transition: { duration: p, ease: "easeInOut" }
35
35
  },
36
36
  exit: {
37
37
  opacity: 0,
38
- transition: { duration: u, ease: "easeInOut" }
38
+ transition: { duration: p, ease: "easeInOut" }
39
39
  }
40
40
  } : {
41
41
  initial: { opacity: 0, height: 0, y: -8 },
@@ -43,108 +43,111 @@ const u = 0.18, $ = (C) => {
43
43
  opacity: 1,
44
44
  height: "auto",
45
45
  y: 0,
46
- transition: { duration: u, ease: "easeOut" }
46
+ transition: { duration: p, ease: "easeOut" }
47
47
  },
48
48
  exit: {
49
49
  opacity: 0,
50
50
  height: 0,
51
51
  y: -8,
52
- transition: { duration: u, ease: "easeInOut" }
52
+ transition: { duration: p, ease: "easeInOut" }
53
53
  }
54
54
  },
55
- [f]
55
+ [v]
56
56
  );
57
- if (!l || !e || !o || l.columns.length === 0 || P !== "body" || !g)
57
+ if (!l || !e || !o || l.columns.length === 0 || k !== "body" || !y)
58
58
  return null;
59
- const c = a, n = g.nextRowIndex(), t = W(c, n, e.rowKey), k = typeof e.rowAnimationProps == "function" ? e.rowAnimationProps(c, n) : e.rowAnimationProps, i = Z({
59
+ const c = r, n = y.nextRowIndex(), t = q(c, n, e.rowKey), K = typeof e.rowAnimationProps == "function" ? e.rowAnimationProps(c, n) : e.rowAnimationProps, i = ee({
60
60
  isClickable: o.isClickable,
61
- onRowClick: (r, d) => {
62
- o.onRowClick?.(r, d), o.onActiveRowChange?.(
61
+ onRowClick: (a, d) => {
62
+ o.onRowClick?.(a, d), o.onActiveRowChange?.(
63
63
  o.activeRowId === t ? void 0 : t,
64
- r,
64
+ a,
65
65
  d
66
66
  );
67
67
  },
68
68
  row: c,
69
69
  rowIndex: n
70
70
  });
71
- let p;
72
- e.expandedRowAnimation !== !1 && (p = {
73
- ...D,
74
- ...k
71
+ let w;
72
+ e.expandedRowAnimation !== !1 && (w = {
73
+ ...O,
74
+ ...K
75
75
  });
76
- const h = o.selectedRowIdSet.has(t), v = A(
76
+ const g = o.selectableRowIdSet.has(t), S = g && o.selectedRowIdSet.has(t), T = P(
77
77
  "table-row",
78
78
  "table-row-expanded-data",
79
79
  !e.isTableView && "divider-y-1 divider-color-lighter divider-style-solid",
80
80
  o.activeRowId === t && "table-row-active",
81
- h && "table-row-selected",
81
+ S && "table-row-selected",
82
82
  i.isClickableClassName,
83
83
  R && "table-row-no-hover",
84
84
  !e.isTableView && e.cardClasses.rowClassName,
85
- m,
86
- X(e.rowClassName, c, n)
87
- ), O = o.showSelectionColumn && /* @__PURE__ */ s(
88
- $,
85
+ u,
86
+ z(e.rowClassName, c, n)
87
+ ), E = o.showSelectionColumn && /* @__PURE__ */ s(
88
+ oe,
89
89
  {
90
- isSelected: h,
90
+ isSelected: S,
91
+ isSelectable: g,
92
+ hideSelectionControl: !g && o.hideSelectionCheckboxesForExcludedRows,
91
93
  isTableView: e.isTableView,
92
94
  onToggleSelection: () => o.onToggleRowSelection?.(t),
93
95
  cardCellClassName: e.cardClasses.cellClassName
94
96
  }
95
- ), T = /* @__PURE__ */ _(M, { children: [
96
- O,
97
- b
98
- ] }), K = {
99
- ...I(a),
100
- className: v,
97
+ ), I = /* @__PURE__ */ M(j, { children: [
98
+ E,
99
+ C
100
+ ] }), V = {
101
+ ...A(r),
102
+ className: T,
101
103
  "data-index": n,
102
104
  "data-row-id": String(t),
103
105
  onClick: i.onClick,
104
106
  onKeyDown: i.onKeyDown,
105
107
  role: "row",
106
108
  tabIndex: i.tabIndex
107
- }, E = {
108
- ...I(a),
109
- className: v,
109
+ }, _ = {
110
+ ...A(r),
111
+ className: T,
110
112
  "data-index": n,
111
113
  "data-row-id": String(t),
112
114
  onClick: i.onClick,
113
115
  onKeyDown: i.onKeyDown,
114
116
  role: "row",
115
117
  tabIndex: i.tabIndex,
116
- onAnimationStart: () => y(!0),
117
- onAnimationComplete: () => y(!1),
118
- ...p,
118
+ onAnimationStart: () => f(!0),
119
+ onAnimationComplete: () => f(!1),
120
+ ...w,
119
121
  style: {
120
- ...p?.style ?? {},
121
- overflow: S ? "hidden" : "visible"
122
+ ...w?.style ?? {},
123
+ overflow: D ? "hidden" : "visible"
122
124
  }
123
125
  }, N = /* @__PURE__ */ s(
124
- Q.Provider,
126
+ Z.Provider,
125
127
  {
126
128
  value: {
127
- nextColumnIndex: (r, d = 1) => {
128
- if (r !== void 0 && r >= 0)
129
- return w.current = r + d, r;
130
- const V = w.current;
131
- return w.current += d, V;
129
+ nextColumnIndex: (a, d = 1) => {
130
+ if (a !== void 0 && a >= 0)
131
+ return m.current = a + d, a;
132
+ const F = m.current;
133
+ return m.current += d, F;
132
134
  },
133
135
  rowIndex: n,
134
136
  rowId: t,
135
137
  rowData: c
136
138
  },
137
- children: p ? /* @__PURE__ */ s(B.div, { ...E, children: T }) : /* @__PURE__ */ s("div", { ...K, children: T })
139
+ children: w ? /* @__PURE__ */ s(H.div, { ..._, children: I }) : /* @__PURE__ */ s("div", { ...V, children: I })
138
140
  }
139
141
  );
140
142
  return l.renderDraft.hasExpandableRows = !0, l.renderDraft.bodyRows.push({
141
143
  rowId: t,
142
144
  rowIndex: n,
143
145
  kind: "expanded",
146
+ selectable: h !== !1,
144
147
  render: () => N
145
148
  }), l.isRegisteringBodyRows ? null : N;
146
149
  };
147
150
  export {
148
- me as default
151
+ pe as default
149
152
  };
150
153
  //# sourceMappingURL=TableExpandedRow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableExpandedRow.js","sources":["../../../src/components/table/TableExpandedRow.tsx"],"sourcesContent":["import { motion, type HTMLMotionProps, useReducedMotion, type MotionProps } from 'motion/react';\nimport { useMemo, useRef, useState, type ReactNode } from 'react';\n\nimport Checkbox from '../checkbox/Checkbox';\nimport classNames from '../../utils/classNames';\nimport type { TableHtmlAttributes, TableRowData } from './Table.types';\nimport { resolveRowClassName, resolveRowKey } from './model/resolveRowMeta';\nimport { useOptionalTableInteractionContext } from './context/TableInteractionContext';\nimport { useOptionalTableRenderConfigContext } from './context/TableRenderConfigContext';\nimport {\n extractTableHtmlAttributes,\n TableRowContext,\n useTableBodyContext,\n useOptionalTableSection,\n} from './context/TableStructureContext';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\nimport { getInteractiveRowProps } from './shared/getInteractiveRowProps';\n\nconst DEFAULT_EXPANDED_ROW_DURATION = 0.18;\n\nexport type TableExpandedRowProps<RowType extends TableRowData> = TableHtmlAttributes &\n Partial<RowType> & {\n /**\n * Parent row key used to associate this expanded row with its parent.\n */\n parentKey: string | number;\n\n /**\n * Optional class names only for this expanded row.\n */\n className?: string;\n\n /**\n * Disable table hover styling for this row.\n */\n noHover?: boolean;\n\n /**\n * Table row content.\n */\n children?: ReactNode;\n };\n\ntype TableExpandedRowSelectionCellProps = {\n isSelected: boolean;\n isTableView: boolean;\n onToggleSelection?: () => void;\n cardCellClassName?: string;\n};\n\nconst TableExpandedRowSelectionCell = (props: TableExpandedRowSelectionCellProps) => {\n const { isSelected, isTableView, onToggleSelection, cardCellClassName } = props;\n return (\n <div\n className={classNames('table-cell table-selection-cell', !isTableView && cardCellClassName)}\n role='cell'\n aria-colindex={1}\n style={isTableView ? { gridColumn: '1 / span 1', gridRow: '1 / span 1' } : undefined}\n onClick={event => event.stopPropagation()}\n onKeyDown={event => event.stopPropagation()}\n >\n <div className='table-selection-control'>\n <Checkbox checked={isSelected} onChange={onToggleSelection} />\n </div>\n </div>\n );\n};\n\nconst TableExpandedRow = <RowType extends TableRowData = TableRowData>(props: TableExpandedRowProps<RowType>) => {\n const { children, className, noHover, parentKey: _parentKey, ...remainingProps } = props;\n\n const renderConfigContext = useOptionalTableRenderConfigContext<RowType>();\n const renderContext = useOptionalTableRenderContext<RowType>();\n const interactionContext = useOptionalTableInteractionContext<RowType>();\n const section = useOptionalTableSection();\n const bodyContext = useTableBodyContext();\n\n const cellIndexRef = useRef(0);\n cellIndexRef.current = 0;\n\n const [isAnimating, setIsAnimating] = useState(true);\n const shouldReduceMotion = useReducedMotion();\n\n const animation = useMemo(\n () =>\n shouldReduceMotion\n ? {\n initial: { opacity: 0 },\n animate: {\n opacity: 1,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n exit: {\n opacity: 0,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n }\n : {\n initial: { opacity: 0, height: 0, y: -8 },\n animate: {\n opacity: 1,\n height: 'auto',\n y: 0,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeOut' as const },\n },\n exit: {\n opacity: 0,\n height: 0,\n y: -8,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n },\n [shouldReduceMotion]\n );\n\n if (\n !renderContext ||\n !renderConfigContext ||\n !interactionContext ||\n renderContext.columns.length === 0 ||\n section !== 'body' ||\n !bodyContext\n ) {\n return null;\n }\n\n const rowData = remainingProps as unknown as RowType;\n const rowIndex = bodyContext.nextRowIndex();\n const rowId = resolveRowKey(rowData, rowIndex, renderConfigContext.rowKey);\n\n const resolvedRowAnimationProps =\n typeof renderConfigContext.rowAnimationProps === 'function'\n ? renderConfigContext.rowAnimationProps(rowData, rowIndex)\n : renderConfigContext.rowAnimationProps;\n\n const interactiveRowProps = getInteractiveRowProps({\n isClickable: interactionContext.isClickable,\n onRowClick: (clickedRow, clickedRowIndex) => {\n interactionContext.onRowClick?.(clickedRow, clickedRowIndex);\n interactionContext.onActiveRowChange?.(\n interactionContext.activeRowId === rowId ? undefined : rowId,\n clickedRow,\n clickedRowIndex\n );\n },\n row: rowData,\n rowIndex,\n });\n\n let mergedRowAnimationProps: MotionProps | undefined;\n\n if (renderConfigContext.expandedRowAnimation !== false) {\n mergedRowAnimationProps = {\n ...animation,\n ...resolvedRowAnimationProps,\n };\n }\n\n const isSelected = interactionContext.selectedRowIdSet.has(rowId);\n\n const rowClassNames = classNames(\n 'table-row',\n 'table-row-expanded-data',\n !renderConfigContext.isTableView && 'divider-y-1 divider-color-lighter divider-style-solid',\n interactionContext.activeRowId === rowId && 'table-row-active',\n isSelected && 'table-row-selected',\n interactiveRowProps.isClickableClassName,\n noHover && 'table-row-no-hover',\n !renderConfigContext.isTableView && renderConfigContext.cardClasses.rowClassName,\n className,\n resolveRowClassName(renderConfigContext.rowClassName, rowData, rowIndex)\n );\n\n const selectionCell = interactionContext.showSelectionColumn && (\n <TableExpandedRowSelectionCell\n isSelected={isSelected}\n isTableView={renderConfigContext.isTableView}\n onToggleSelection={() => interactionContext.onToggleRowSelection?.(rowId)}\n cardCellClassName={renderConfigContext.cardClasses.cellClassName}\n />\n );\n\n const rowContent = (\n <>\n {selectionCell}\n {children}\n </>\n );\n\n const staticRowProps = {\n ...extractTableHtmlAttributes(remainingProps),\n className: rowClassNames,\n 'data-index': rowIndex,\n 'data-row-id': String(rowId),\n onClick: interactiveRowProps.onClick,\n onKeyDown: interactiveRowProps.onKeyDown,\n role: 'row' as const,\n tabIndex: interactiveRowProps.tabIndex,\n };\n\n const animatedRowProps = {\n ...(extractTableHtmlAttributes(remainingProps) as Omit<\n HTMLMotionProps<'div'>,\n 'children' | 'className' | 'data-row-id' | 'onClick' | 'onKeyDown' | 'role' | 'style' | 'tabIndex'\n >),\n className: rowClassNames,\n 'data-index': rowIndex,\n 'data-row-id': String(rowId),\n onClick: interactiveRowProps.onClick,\n onKeyDown: interactiveRowProps.onKeyDown,\n role: 'row' as const,\n tabIndex: interactiveRowProps.tabIndex,\n onAnimationStart: () => setIsAnimating(true),\n onAnimationComplete: () => setIsAnimating(false),\n ...mergedRowAnimationProps,\n style: {\n ...(mergedRowAnimationProps?.style ?? {}),\n overflow: isAnimating ? 'hidden' : 'visible',\n },\n };\n\n const rowNode = (\n <TableRowContext.Provider\n value={{\n nextColumnIndex: (explicitColumnIndex, span = 1) => {\n if (explicitColumnIndex !== undefined && explicitColumnIndex >= 0) {\n cellIndexRef.current = explicitColumnIndex + span;\n return explicitColumnIndex;\n }\n\n const nextIndex = cellIndexRef.current;\n cellIndexRef.current += span;\n return nextIndex;\n },\n rowIndex,\n rowId,\n rowData,\n }}\n >\n {mergedRowAnimationProps ? (\n <motion.div {...animatedRowProps}>{rowContent}</motion.div>\n ) : (\n <div {...staticRowProps}>{rowContent}</div>\n )}\n </TableRowContext.Provider>\n );\n\n renderContext.renderDraft.hasExpandableRows = true;\n renderContext.renderDraft.bodyRows.push({\n rowId,\n rowIndex,\n kind: 'expanded',\n render: () => rowNode,\n });\n\n return renderContext.isRegisteringBodyRows ? null : rowNode;\n};\n\nexport default TableExpandedRow;\n"],"names":["DEFAULT_EXPANDED_ROW_DURATION","TableExpandedRowSelectionCell","props","isSelected","isTableView","onToggleSelection","cardCellClassName","jsx","classNames","event","Checkbox","TableExpandedRow","children","className","noHover","_parentKey","remainingProps","renderConfigContext","useOptionalTableRenderConfigContext","renderContext","useOptionalTableRenderContext","interactionContext","useOptionalTableInteractionContext","section","useOptionalTableSection","bodyContext","useTableBodyContext","cellIndexRef","useRef","isAnimating","setIsAnimating","useState","shouldReduceMotion","useReducedMotion","animation","useMemo","rowData","rowIndex","rowId","resolveRowKey","resolvedRowAnimationProps","interactiveRowProps","getInteractiveRowProps","clickedRow","clickedRowIndex","mergedRowAnimationProps","rowClassNames","resolveRowClassName","selectionCell","rowContent","jsxs","Fragment","staticRowProps","extractTableHtmlAttributes","animatedRowProps","rowNode","TableRowContext","explicitColumnIndex","span","nextIndex","motion"],"mappings":";;;;;;;;;;;AAkBA,MAAMA,IAAgC,MAgChCC,IAAgC,CAACC,MAA8C;AACjF,QAAM,EAAE,YAAAC,GAAY,aAAAC,GAAa,mBAAAC,GAAmB,mBAAAC,MAAsBJ;AAC1E,SACI,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWC,EAAW,mCAAmC,CAACJ,KAAeE,CAAiB;AAAA,MAC1F,MAAK;AAAA,MACL,iBAAe;A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UAAAS,IACG,gBAAAtC,EAACqD,EAAO,KAAP,EAAY,GAAGN,GAAmB,UAAAL,EAAA,CAAW,IAE9C,gBAAA1C,EAAC,OAAA,EAAK,GAAG6C,GAAiB,UAAAH,EAAA,CAAW;AAAA,IAAA;AAAA,EAAA;AAKjD,SAAA9B,EAAc,YAAY,oBAAoB,IAC9CA,EAAc,YAAY,SAAS,KAAK;AAAA,IACpC,OAAAmB;AAAA,IACA,UAAAD;AAAA,IACA,MAAM;AAAA,IACN,QAAQ,MAAMkB;AAAA,EAAA,CACjB,GAEMpC,EAAc,wBAAwB,OAAOoC;AACxD;"}
1
+ {"version":3,"file":"TableExpandedRow.js","sources":["../../../src/components/table/TableExpandedRow.tsx"],"sourcesContent":["import { motion, type HTMLMotionProps, useReducedMotion, type MotionProps } from 'motion/react';\nimport { useMemo, useRef, useState, type ReactNode } from 'react';\n\nimport Checkbox from '../checkbox/Checkbox';\nimport classNames from '../../utils/classNames';\nimport type { TableHtmlAttributes, TableRowData } from './Table.types';\nimport { resolveRowClassName, resolveRowKey } from './model/resolveRowMeta';\nimport { useOptionalTableInteractionContext } from './context/TableInteractionContext';\nimport { useOptionalTableRenderConfigContext } from './context/TableRenderConfigContext';\nimport {\n extractTableHtmlAttributes,\n TableRowContext,\n useTableBodyContext,\n useOptionalTableSection,\n} from './context/TableStructureContext';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\nimport { getInteractiveRowProps } from './shared/getInteractiveRowProps';\n\nconst DEFAULT_EXPANDED_ROW_DURATION = 0.18;\n\nexport type TableExpandedRowProps<RowType extends TableRowData> = TableHtmlAttributes &\n Partial<RowType> & {\n /**\n * Parent row key used to associate this expanded row with its parent.\n */\n parentKey: string | number;\n\n /**\n * Optional class names only for this expanded row.\n */\n className?: string;\n\n /**\n * Excludes this row from table selection while keeping the row interactive.\n */\n selectable?: boolean;\n\n /**\n * Disable table hover styling for this row.\n */\n noHover?: boolean;\n\n /**\n * Table row content.\n */\n children?: ReactNode;\n };\n\ntype TableExpandedRowSelectionCellProps = {\n isSelected: boolean;\n isSelectable: boolean;\n hideSelectionControl?: boolean;\n isTableView: boolean;\n onToggleSelection?: () => void;\n cardCellClassName?: string;\n};\n\nconst TableExpandedRowSelectionCell = (props: TableExpandedRowSelectionCellProps) => {\n const { isSelected, isSelectable, hideSelectionControl, isTableView, onToggleSelection, cardCellClassName } = props;\n return (\n <div\n className={classNames('table-cell table-selection-cell', !isTableView && cardCellClassName)}\n role='cell'\n aria-colindex={1}\n style={isTableView ? { gridColumn: '1 / span 1', gridRow: '1 / span 1' } : undefined}\n onClick={event => event.stopPropagation()}\n onKeyDown={event => event.stopPropagation()}\n >\n {!hideSelectionControl && (\n <div className='table-selection-control'>\n <Checkbox checked={isSelected} disabled={!isSelectable} onChange={onToggleSelection} />\n </div>\n )}\n </div>\n );\n};\n\nconst TableExpandedRow = <RowType extends TableRowData = TableRowData>(props: TableExpandedRowProps<RowType>) => {\n const { children, className, noHover, parentKey: _parentKey, selectable, ...remainingProps } = props;\n\n const renderConfigContext = useOptionalTableRenderConfigContext<RowType>();\n const renderContext = useOptionalTableRenderContext<RowType>();\n const interactionContext = useOptionalTableInteractionContext<RowType>();\n const section = useOptionalTableSection();\n const bodyContext = useTableBodyContext();\n\n const cellIndexRef = useRef(0);\n cellIndexRef.current = 0;\n\n const [isAnimating, setIsAnimating] = useState(true);\n const shouldReduceMotion = useReducedMotion();\n\n const animation = useMemo(\n () =>\n shouldReduceMotion\n ? {\n initial: { opacity: 0 },\n animate: {\n opacity: 1,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n exit: {\n opacity: 0,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n }\n : {\n initial: { opacity: 0, height: 0, y: -8 },\n animate: {\n opacity: 1,\n height: 'auto',\n y: 0,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeOut' as const },\n },\n exit: {\n opacity: 0,\n height: 0,\n y: -8,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n },\n [shouldReduceMotion]\n );\n\n if (\n !renderContext ||\n !renderConfigContext ||\n !interactionContext ||\n renderContext.columns.length === 0 ||\n section !== 'body' ||\n !bodyContext\n ) {\n return null;\n }\n\n const rowData = remainingProps as unknown as RowType;\n const rowIndex = bodyContext.nextRowIndex();\n const rowId = resolveRowKey(rowData, rowIndex, renderConfigContext.rowKey);\n\n const resolvedRowAnimationProps =\n typeof renderConfigContext.rowAnimationProps === 'function'\n ? renderConfigContext.rowAnimationProps(rowData, rowIndex)\n : renderConfigContext.rowAnimationProps;\n\n const interactiveRowProps = getInteractiveRowProps({\n isClickable: interactionContext.isClickable,\n onRowClick: (clickedRow, clickedRowIndex) => {\n interactionContext.onRowClick?.(clickedRow, clickedRowIndex);\n interactionContext.onActiveRowChange?.(\n interactionContext.activeRowId === rowId ? undefined : rowId,\n clickedRow,\n clickedRowIndex\n );\n },\n row: rowData,\n rowIndex,\n });\n\n let mergedRowAnimationProps: MotionProps | undefined;\n\n if (renderConfigContext.expandedRowAnimation !== false) {\n mergedRowAnimationProps = {\n ...animation,\n ...resolvedRowAnimationProps,\n };\n }\n\n const isSelectable = interactionContext.selectableRowIdSet.has(rowId);\n const isSelected = isSelectable && interactionContext.selectedRowIdSet.has(rowId);\n\n const rowClassNames = classNames(\n 'table-row',\n 'table-row-expanded-data',\n !renderConfigContext.isTableView && 'divider-y-1 divider-color-lighter divider-style-solid',\n interactionContext.activeRowId === rowId && 'table-row-active',\n isSelected && 'table-row-selected',\n interactiveRowProps.isClickableClassName,\n noHover && 'table-row-no-hover',\n !renderConfigContext.isTableView && renderConfigContext.cardClasses.rowClassName,\n className,\n resolveRowClassName(renderConfigContext.rowClassName, rowData, rowIndex)\n );\n\n const selectionCell = interactionContext.showSelectionColumn && (\n <TableExpandedRowSelectionCell\n isSelected={isSelected}\n isSelectable={isSelectable}\n hideSelectionControl={!isSelectable && interactionContext.hideSelectionCheckboxesForExcludedRows}\n isTableView={renderConfigContext.isTableView}\n onToggleSelection={() => interactionContext.onToggleRowSelection?.(rowId)}\n cardCellClassName={renderConfigContext.cardClasses.cellClassName}\n />\n );\n\n const rowContent = (\n <>\n {selectionCell}\n {children}\n </>\n );\n\n const staticRowProps = {\n ...extractTableHtmlAttributes(remainingProps),\n className: rowClassNames,\n 'data-index': rowIndex,\n 'data-row-id': String(rowId),\n onClick: interactiveRowProps.onClick,\n onKeyDown: interactiveRowProps.onKeyDown,\n role: 'row' as const,\n tabIndex: interactiveRowProps.tabIndex,\n };\n\n const animatedRowProps = {\n ...(extractTableHtmlAttributes(remainingProps) as Omit<\n HTMLMotionProps<'div'>,\n 'children' | 'className' | 'data-row-id' | 'onClick' | 'onKeyDown' | 'role' | 'style' | 'tabIndex'\n >),\n className: rowClassNames,\n 'data-index': rowIndex,\n 'data-row-id': String(rowId),\n onClick: interactiveRowProps.onClick,\n onKeyDown: interactiveRowProps.onKeyDown,\n role: 'row' as const,\n tabIndex: interactiveRowProps.tabIndex,\n onAnimationStart: () => setIsAnimating(true),\n onAnimationComplete: () => setIsAnimating(false),\n ...mergedRowAnimationProps,\n style: {\n ...(mergedRowAnimationProps?.style ?? {}),\n overflow: isAnimating ? 'hidden' : 'visible',\n },\n };\n\n const rowNode = (\n <TableRowContext.Provider\n value={{\n nextColumnIndex: (explicitColumnIndex, span = 1) => {\n if (explicitColumnIndex !== undefined && explicitColumnIndex >= 0) {\n cellIndexRef.current = explicitColumnIndex + span;\n return explicitColumnIndex;\n }\n\n const nextIndex = cellIndexRef.current;\n cellIndexRef.current += span;\n return nextIndex;\n },\n rowIndex,\n rowId,\n rowData,\n }}\n >\n {mergedRowAnimationProps ? (\n <motion.div {...animatedRowProps}>{rowContent}</motion.div>\n ) : (\n <div {...staticRowProps}>{rowContent}</div>\n )}\n </TableRowContext.Provider>\n );\n\n renderContext.renderDraft.hasExpandableRows = true;\n renderContext.renderDraft.bodyRows.push({\n rowId,\n rowIndex,\n kind: 'expanded',\n selectable: selectable !== false,\n render: () => rowNode,\n });\n\n return renderContext.isRegisteringBodyRows ? null : rowNode;\n};\n\nexport default TableExpandedRow;\n"],"names":["DEFAULT_EXPANDED_ROW_DURATION","TableExpandedRowSelectionCell","props","isSelected","isSelectable","hideSelectionControl","isTableView","onToggleSelection","cardCellClassName","jsx","classNames","event","Checkbox","TableExpandedRow","children","className","noHover","_parentKey","selectable","remainingProps","renderConfigContext","useOptionalTableRenderConfigContext","renderContext","useOptionalTableRenderContext","interactionContext","useOptionalTableInteractionContext","section","useOptionalTableSection","bodyContext","useTableBodyContext","cellIndexRef","useRef","isAnimating","setIsAnimating","useState","shouldReduceMotion","useReducedMotion","animation","useMemo","rowData","rowIndex","rowId","resolveRowKey","resolvedRowAnimationProps","interactiveRowProps","getInteractiveRowProps","clickedRow","clickedRowIndex","mergedRowAnimationProps","rowClassNames","resolveRowClassName","selectionCell","rowContent","jsxs","Fragment","staticRowProps","extractTableHtmlAttributes","animatedRowProps","rowNode","TableRowContext","explicitColumnIndex","span","nextIndex","motion"],"mappings":";;;;;;;;;;;AAkBA,MAAMA,IAAgC,MAuChCC,KAAgC,CAACC,MAA8C;AACjF,QAAM,EAAE,YAAAC,GAAY,cAAAC,GAAc,sBAAAC,GAAsB,aAAAC,GAAa,mBAAAC,GAAmB,mBAAAC,MAAsBN;AAC9G,SACI,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWC,EAAW,mCAAmC,CAACJ,KAAeE,CAAiB;AAAA,MAC1F,MAAK;AAAA,MACL,iBAAe;AAAA,MACf,OAAOF,IAAc,EAAE,YAAY,cAAc,SAAS,iBAAiB;AAAA,MAC3E,SAAS,CAAAK,MAASA,EAAM,gBAAA;AAAA,MACxB,WAAW,CAAAA,MAASA,EAAM,gBAAA;AAAA,MAEzB,UAAA,CAACN,KACE,gBAAAI,EAAC,OAAA,EAAI,WAAU,2BACX,UAAA,gBAAAA,EAACG,GAAA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EAAA,CAAW,IAE9C,gBAAA3C,EAAC,OAAA,EAAK,GAAG8C,GAAiB,UAAAH,EAAA,CAAW;AAAA,IAAA;AAAA,EAAA;AAKjD,SAAA9B,EAAc,YAAY,oBAAoB,IAC9CA,EAAc,YAAY,SAAS,KAAK;AAAA,IACpC,OAAAmB;AAAA,IACA,UAAAD;AAAA,IACA,MAAM;AAAA,IACN,YAAYtB,MAAe;AAAA,IAC3B,QAAQ,MAAMwC;AAAA,EAAA,CACjB,GAEMpC,EAAc,wBAAwB,OAAOoC;AACxD;"}
@@ -6,7 +6,9 @@ export type TableGroupRowProps = TableHtmlAttributes & {
6
6
  */
7
7
  children?: ReactNode;
8
8
  /**
9
- * Keeps the group row sticky at the top of a scrollable table body.
9
+ * Keeps the group row sticky at the top of the current table scroll context.
10
+ * When a sticky `TableHeader` is present, the row stacks below the measured header height.
11
+ * `TableBody maxHeight` continues to pin the row inside the internal body scroller.
10
12
  *
11
13
  * @default false
12
14
  */
@@ -1,34 +1,35 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import b from "../../utils/classNames.js";
3
- import { useOptionalTableInteractionContext as w } from "./context/TableInteractionContext.js";
4
- import { useOptionalTableSection as x, useTableBodyContext as g } from "./context/TableStructureContext.js";
2
+ import w from "../../utils/classNames.js";
3
+ import { useOptionalTableInteractionContext as x } from "./context/TableInteractionContext.js";
4
+ import { useOptionalTableSection as g, useTableBodyContext as y } from "./context/TableStructureContext.js";
5
5
  import { useOptionalTableRenderContext as f } from "./context/TableRenderContext.js";
6
- const v = (s) => {
7
- const { children: a, className: c, noHover: i, sticky: d, ...u } = s, o = f(), n = w(), m = x(), r = g();
8
- if (!o || !n || o.columns.length === 0 || m !== "body" || !r)
6
+ const v = (a) => {
7
+ const { children: c, className: i, noHover: d, sticky: n, ...u } = a, o = f(), r = x(), m = g(), l = y();
8
+ if (!o || !r || o.columns.length === 0 || m !== "body" || !l)
9
9
  return null;
10
- const e = r.nextRowIndex(), p = o.columns.length + (n.showSelectionColumn ? 1 : 0), l = /* @__PURE__ */ t(
10
+ const e = l.nextRowIndex(), p = o.columns.length + (r.showSelectionColumn ? 1 : 0), b = !!o.renderDraft.bodyMaxHeight, s = /* @__PURE__ */ t(
11
11
  "div",
12
12
  {
13
13
  ...u,
14
- className: b(
14
+ className: w(
15
15
  "table-row",
16
16
  "table-row-group",
17
- d && "table-row-group-sticky",
18
- i && "table-row-no-hover",
19
- c
17
+ n && "table-row-group-sticky",
18
+ n && b && "table-row-sticky-in-container",
19
+ d && "table-row-no-hover",
20
+ i
20
21
  ),
21
22
  "data-index": e,
22
23
  role: "row",
23
- children: /* @__PURE__ */ t("div", { className: "table-cell table-group-cell", role: "cell", "aria-colspan": p, children: /* @__PURE__ */ t("div", { className: "table-cell-content", children: a }) })
24
+ children: /* @__PURE__ */ t("div", { className: "table-cell table-group-cell", role: "cell", "aria-colspan": p, children: /* @__PURE__ */ t("div", { className: "table-cell-content", children: c }) })
24
25
  }
25
26
  );
26
27
  return o.renderDraft.bodyRows.push({
27
28
  rowId: `group-${e}`,
28
29
  rowIndex: e,
29
30
  kind: "group",
30
- render: () => l
31
- }), o.isRegisteringBodyRows ? null : l;
31
+ render: () => s
32
+ }), o.isRegisteringBodyRows ? null : s;
32
33
  };
33
34
  export {
34
35
  v as default
@@ -1 +1 @@
1
- {"version":3,"file":"TableGroupRow.js","sources":["../../../src/components/table/TableGroupRow.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport type { TableHtmlAttributes } from './Table.types';\nimport { useOptionalTableInteractionContext } from './context/TableInteractionContext';\nimport { useTableBodyContext, useOptionalTableSection } from './context/TableStructureContext';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\n\nexport type TableGroupRowProps = TableHtmlAttributes & {\n /**\n * The content of the full-width group row.\n */\n children?: ReactNode;\n\n /**\n * Keeps the group row sticky at the top of a scrollable table body.\n *\n * @default false\n */\n sticky?: boolean;\n\n /**\n * Optional class names only for this group row.\n */\n className?: string;\n\n /**\n * Disable table hover styling for this row.\n */\n noHover?: boolean;\n};\n\nconst TableGroupRow = (props: TableGroupRowProps) => {\n const { children, className, noHover, sticky, ...remainingProps } = props;\n\n const renderContext = useOptionalTableRenderContext();\n const interactionContext = useOptionalTableInteractionContext();\n const section = useOptionalTableSection();\n const bodyContext = useTableBodyContext();\n\n if (\n !renderContext ||\n !interactionContext ||\n renderContext.columns.length === 0 ||\n section !== 'body' ||\n !bodyContext\n ) {\n return null;\n }\n\n const rowIndex = bodyContext.nextRowIndex();\n const columnCount = renderContext.columns.length + (interactionContext.showSelectionColumn ? 1 : 0);\n\n const rowNode = (\n <div\n {...remainingProps}\n className={classNames(\n 'table-row',\n 'table-row-group',\n sticky && 'table-row-group-sticky',\n noHover && 'table-row-no-hover',\n className\n )}\n data-index={rowIndex}\n role='row'\n >\n <div className='table-cell table-group-cell' role='cell' aria-colspan={columnCount}>\n <div className='table-cell-content'>{children}</div>\n </div>\n </div>\n );\n\n renderContext.renderDraft.bodyRows.push({\n rowId: `group-${rowIndex}`,\n rowIndex,\n kind: 'group',\n render: () => rowNode,\n });\n\n return renderContext.isRegisteringBodyRows ? null : rowNode;\n};\n\nexport default TableGroupRow;\n"],"names":["TableGroupRow","props","children","className","noHover","sticky","remainingProps","renderContext","useOptionalTableRenderContext","interactionContext","useOptionalTableInteractionContext","section","useOptionalTableSection","bodyContext","useTableBodyContext","rowIndex","columnCount","rowNode","jsx","classNames"],"mappings":";;;;;AAgCA,MAAMA,IAAgB,CAACC,MAA8B;AACjD,QAAM,EAAE,UAAAC,GAAU,WAAAC,GAAW,SAAAC,GAAS,QAAAC,GAAQ,GAAGC,MAAmBL,GAE9DM,IAAgBC,EAAA,GAChBC,IAAqBC,EAAA,GACrBC,IAAUC,EAAA,GACVC,IAAcC,EAAA;AAEpB,MACI,CAACP,KACD,CAACE,KACDF,EAAc,QAAQ,WAAW,KACjCI,MAAY,UACZ,CAACE;AAED,WAAO;AAGX,QAAME,IAAWF,EAAY,aAAA,GACvBG,IAAcT,EAAc,QAAQ,UAAUE,EAAmB,sBAAsB,IAAI,IAE3FQ,IACF,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGZ;AAAA,MACJ,WAAWa;AAAA,QACP;AAAA,QACA;AAAA,QACAd,KAAU;AAAA,QACVD,KAAW;AAAA,QACXD;AAAA,MAAA;AAAA,MAEJ,cAAYY;AAAA,MACZ,MAAK;AAAA,MAEL,UAAA,gBAAAG,EAAC,OAAA,EAAI,WAAU,+BAA8B,MAAK,QAAO,gBAAcF,GACnE,UAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,sBAAsB,UAAAhB,GAAS,EAAA,CAClD;AAAA,IAAA;AAAA,EAAA;AAIR,SAAAK,EAAc,YAAY,SAAS,KAAK;AAAA,IACpC,OAAO,SAASQ,CAAQ;AAAA,IACxB,UAAAA;AAAA,IACA,MAAM;AAAA,IACN,QAAQ,MAAME;AAAA,EAAA,CACjB,GAEMV,EAAc,wBAAwB,OAAOU;AACxD;"}
1
+ {"version":3,"file":"TableGroupRow.js","sources":["../../../src/components/table/TableGroupRow.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport type { TableHtmlAttributes } from './Table.types';\nimport { useOptionalTableInteractionContext } from './context/TableInteractionContext';\nimport { useTableBodyContext, useOptionalTableSection } from './context/TableStructureContext';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\n\nexport type TableGroupRowProps = TableHtmlAttributes & {\n /**\n * The content of the full-width group row.\n */\n children?: ReactNode;\n\n /**\n * Keeps the group row sticky at the top of the current table scroll context.\n * When a sticky `TableHeader` is present, the row stacks below the measured header height.\n * `TableBody maxHeight` continues to pin the row inside the internal body scroller.\n *\n * @default false\n */\n sticky?: boolean;\n\n /**\n * Optional class names only for this group row.\n */\n className?: string;\n\n /**\n * Disable table hover styling for this row.\n */\n noHover?: boolean;\n};\n\nconst TableGroupRow = (props: TableGroupRowProps) => {\n const { children, className, noHover, sticky, ...remainingProps } = props;\n\n const renderContext = useOptionalTableRenderContext();\n const interactionContext = useOptionalTableInteractionContext();\n const section = useOptionalTableSection();\n const bodyContext = useTableBodyContext();\n\n if (\n !renderContext ||\n !interactionContext ||\n renderContext.columns.length === 0 ||\n section !== 'body' ||\n !bodyContext\n ) {\n return null;\n }\n\n const rowIndex = bodyContext.nextRowIndex();\n const columnCount = renderContext.columns.length + (interactionContext.showSelectionColumn ? 1 : 0);\n const stickyInBodyScrollContainer = !!renderContext.renderDraft.bodyMaxHeight;\n\n const rowNode = (\n <div\n {...remainingProps}\n className={classNames(\n 'table-row',\n 'table-row-group',\n sticky && 'table-row-group-sticky',\n sticky && stickyInBodyScrollContainer && 'table-row-sticky-in-container',\n noHover && 'table-row-no-hover',\n className\n )}\n data-index={rowIndex}\n role='row'\n >\n <div className='table-cell table-group-cell' role='cell' aria-colspan={columnCount}>\n <div className='table-cell-content'>{children}</div>\n </div>\n </div>\n );\n\n renderContext.renderDraft.bodyRows.push({\n rowId: `group-${rowIndex}`,\n rowIndex,\n kind: 'group',\n render: () => rowNode,\n });\n\n return renderContext.isRegisteringBodyRows ? null : rowNode;\n};\n\nexport default TableGroupRow;\n"],"names":["TableGroupRow","props","children","className","noHover","sticky","remainingProps","renderContext","useOptionalTableRenderContext","interactionContext","useOptionalTableInteractionContext","section","useOptionalTableSection","bodyContext","useTableBodyContext","rowIndex","columnCount","stickyInBodyScrollContainer","rowNode","jsx","classNames"],"mappings":";;;;;AAkCA,MAAMA,IAAgB,CAACC,MAA8B;AACjD,QAAM,EAAE,UAAAC,GAAU,WAAAC,GAAW,SAAAC,GAAS,QAAAC,GAAQ,GAAGC,MAAmBL,GAE9DM,IAAgBC,EAAA,GAChBC,IAAqBC,EAAA,GACrBC,IAAUC,EAAA,GACVC,IAAcC,EAAA;AAEpB,MACI,CAACP,KACD,CAACE,KACDF,EAAc,QAAQ,WAAW,KACjCI,MAAY,UACZ,CAACE;AAED,WAAO;AAGX,QAAME,IAAWF,EAAY,aAAA,GACvBG,IAAcT,EAAc,QAAQ,UAAUE,EAAmB,sBAAsB,IAAI,IAC3FQ,IAA8B,CAAC,CAACV,EAAc,YAAY,eAE1DW,IACF,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGb;AAAA,MACJ,WAAWc;AAAA,QACP;AAAA,QACA;AAAA,QACAf,KAAU;AAAA,QACVA,KAAUY,KAA+B;AAAA,QACzCb,KAAW;AAAA,QACXD;AAAA,MAAA;AAAA,MAEJ,cAAYY;AAAA,MACZ,MAAK;AAAA,MAEL,UAAA,gBAAAI,EAAC,OAAA,EAAI,WAAU,+BAA8B,MAAK,QAAO,gBAAcH,GACnE,UAAA,gBAAAG,EAAC,OAAA,EAAI,WAAU,sBAAsB,UAAAjB,GAAS,EAAA,CAClD;AAAA,IAAA;AAAA,EAAA;AAIR,SAAAK,EAAc,YAAY,SAAS,KAAK;AAAA,IACpC,OAAO,SAASQ,CAAQ;AAAA,IACxB,UAAAA;AAAA,IACA,MAAM;AAAA,IACN,QAAQ,MAAMG;AAAA,EAAA,CACjB,GAEMX,EAAc,wBAAwB,OAAOW;AACxD;"}
@@ -7,21 +7,13 @@ export type TableHeaderProps<RowType extends TableRowData> = TableHtmlAttributes
7
7
  className?: string;
8
8
  /**
9
9
  * Keeps the table header sticky while the page scrolls.
10
+ * The sticky top reference follows `Table.stickyReference`.
10
11
  *
11
12
  * This applies in `TABLE` view only.
12
13
  *
13
14
  * @default false
14
15
  */
15
16
  sticky?: boolean;
16
- /**
17
- * Keeps the sticky header pinned to the top edge of an explicit scroll container.
18
- *
19
- * Use this when the table sits inside a wrapper with an overflow class like `overflow-y-scroll`.
20
- * When omitted, sticky headers compensate the default `ApplicationLayout` body padding.
21
- *
22
- * @default false
23
- */
24
- stickyInContainer?: boolean;
25
17
  /**
26
18
  * Table header content.
27
19
  */