@jetbrains/ring-ui-built 8.0.0-beta.2 → 8.0.0-beta.4

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 (214) hide show
  1. package/components/_helpers/anchor.js +1 -1
  2. package/components/_helpers/avatar-info.js +1 -1
  3. package/components/_helpers/heading.js +2 -2
  4. package/components/_helpers/icon-svg.js +1 -1
  5. package/components/_helpers/legacy-table.js +3 -0
  6. package/components/_helpers/tab-link.js +1 -1
  7. package/components/_helpers/table.js +1 -1
  8. package/components/_helpers/theme.js +50 -38
  9. package/components/alert/alert.js +2 -2
  10. package/components/alert-service/alert-service.js +1 -1
  11. package/components/auth/auth-core.js +1 -1
  12. package/components/auth/auth.js +1 -1
  13. package/components/auth/down-notification.js +1 -1
  14. package/components/auth/iframe-flow.js +2 -2
  15. package/components/auth/storage.js +1 -1
  16. package/components/auth-dialog/auth-dialog.js +1 -1
  17. package/components/auth-dialog-service/auth-dialog-service.js +2 -2
  18. package/components/avatar/avatar-info.js +1 -1
  19. package/components/avatar/avatar.js +1 -1
  20. package/components/avatar/fallback-avatar.js +1 -1
  21. package/components/avatar-stack/avatar-stack.js +1 -1
  22. package/components/banner/banner.js +1 -1
  23. package/components/button/button.js +1 -1
  24. package/components/button-group/button-group.js +1 -1
  25. package/components/checkbox/checkbox.d.ts +1 -1
  26. package/components/checkbox/checkbox.js +1 -1
  27. package/components/clipboard/clipboard.js +1 -1
  28. package/components/collapse/collapse-content.js +5 -5
  29. package/components/collapse/collapse-control.js +5 -5
  30. package/components/collapse/collapse.js +4 -4
  31. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  32. package/components/collapsible-group/collapsible-group.js +382 -0
  33. package/components/components/util-stories.js +63 -1
  34. package/components/confirm/confirm.js +1 -1
  35. package/components/confirm-service/confirm-service.js +2 -2
  36. package/components/contenteditable/contenteditable.js +1 -1
  37. package/components/control-help/control-help.js +1 -1
  38. package/components/control-label/control-label.js +1 -1
  39. package/components/data-list/data-list.d.ts +1 -1
  40. package/components/data-list/data-list.js +1 -1
  41. package/components/data-list/data-list.mock.d.ts +1 -1
  42. package/components/data-list/data-list.mock.js +1 -1
  43. package/components/data-list/item.d.ts +1 -1
  44. package/components/data-list/item.js +1 -1
  45. package/components/data-list/selection.d.ts +1 -1
  46. package/components/data-list/selection.js +2 -2
  47. package/components/data-list/title.js +1 -1
  48. package/components/date-picker/date-input.js +1 -1
  49. package/components/date-picker/date-picker.js +1 -2
  50. package/components/date-picker/date-popup.js +4 -5
  51. package/components/date-picker/month-names.js +1 -1
  52. package/components/date-picker/month-slider.js +1 -1
  53. package/components/date-picker/month.js +1 -1
  54. package/components/date-picker/months.js +4 -5
  55. package/components/date-picker/use-scroll-behavior.js +45 -44
  56. package/components/date-picker/weekdays.js +1 -1
  57. package/components/date-picker/years.js +6 -7
  58. package/components/dialog/dialog.d.ts +2 -2
  59. package/components/dialog/dialog.js +3 -3
  60. package/components/dropdown/anchor.js +1 -1
  61. package/components/dropdown/dropdown.js +1 -1
  62. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  63. package/components/dropdown-menu/dropdown-menu.js +68 -63
  64. package/components/editable-heading/editable-heading.d.ts +1 -2
  65. package/components/editable-heading/editable-heading.js +127 -113
  66. package/components/error-bubble/error-bubble.js +1 -1
  67. package/components/error-message/error-message.js +1 -1
  68. package/components/expand/collapsible-group.d.ts +8 -16
  69. package/components/expand/collapsible-group.js +34 -364
  70. package/components/footer/footer.js +1 -1
  71. package/components/global/compose-refs.d.ts +2 -1
  72. package/components/global/compose-refs.js +44 -8
  73. package/components/global/create-stateful-context.js +11 -11
  74. package/components/global/focus-sensor-hoc.js +1 -0
  75. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  76. package/components/global/focus-with-temporary-tabindex.js +23 -0
  77. package/components/global/intersection-observer-context.d.ts +31 -11
  78. package/components/global/intersection-observer-context.js +55 -57
  79. package/components/global/is-within-interactive-element.d.ts +6 -0
  80. package/components/global/is-within-interactive-element.js +11 -0
  81. package/components/global/is-within-navigable-element.d.ts +6 -0
  82. package/components/global/is-within-navigable-element.js +11 -0
  83. package/components/global/parse-css-duration.d.ts +5 -0
  84. package/components/global/parse-css-duration.js +14 -0
  85. package/components/global/rerender-hoc.d.ts +4 -2
  86. package/components/global/rerender-hoc.js +11 -24
  87. package/components/global/schedule-with-cleanup.d.ts +12 -0
  88. package/components/global/schedule-with-cleanup.js +36 -0
  89. package/components/{legacy-table/selection.d.ts → global/table-selection.d.ts} +14 -14
  90. package/components/{legacy-table/selection.js → global/table-selection.js} +4 -4
  91. package/components/global/theme.d.ts +4 -3
  92. package/components/global/theme.js +2 -2
  93. package/components/header/header-icon.js +1 -1
  94. package/components/header/header.js +2 -2
  95. package/components/header/links.js +1 -1
  96. package/components/header/logo.js +1 -1
  97. package/components/header/profile.js +1 -1
  98. package/components/header/services.js +1 -1
  99. package/components/header/smart-profile.js +1 -1
  100. package/components/header/smart-services.js +1 -1
  101. package/components/heading/heading.js +4 -4
  102. package/components/i18n/i18n-context.js +4 -4
  103. package/components/icon/icon-svg.js +1 -1
  104. package/components/icon/icon.js +1 -1
  105. package/components/icon/index.js +1 -1
  106. package/components/input/input.d.ts +1 -1
  107. package/components/input/input.js +1 -1
  108. package/components/internal/column-animation.js +133 -0
  109. package/components/internal/table-header.js +1109 -0
  110. package/components/internal/virtual-items.js +353 -0
  111. package/components/island/adaptive-island-hoc.js +3 -3
  112. package/components/island/content.d.ts +7 -2
  113. package/components/island/content.js +27 -18
  114. package/components/island/header.js +1 -1
  115. package/components/island/island.js +1 -1
  116. package/components/legacy-table/cell.js +1 -1
  117. package/components/legacy-table/header-cell.js +4 -4
  118. package/components/legacy-table/header.js +2 -2
  119. package/components/legacy-table/multitable.d.ts +1 -1
  120. package/components/legacy-table/row-with-focus-sensor.js +2 -2
  121. package/components/legacy-table/row.d.ts +1 -1
  122. package/components/legacy-table/row.js +4 -4
  123. package/components/legacy-table/selection-adapter.d.ts +3 -3
  124. package/components/legacy-table/selection-shortcuts-hoc.d.ts +5 -5
  125. package/components/legacy-table/simple-table.d.ts +2 -2
  126. package/components/legacy-table/simple-table.js +4 -4
  127. package/components/legacy-table/smart-table.d.ts +5 -5
  128. package/components/legacy-table/smart-table.js +5 -5
  129. package/components/legacy-table/table.js +2 -2
  130. package/components/list/list-item.js +1 -1
  131. package/components/list/list-users-groups-source.js +1 -1
  132. package/components/list/list.js +1 -1
  133. package/components/login-dialog/login-dialog.js +1 -1
  134. package/components/login-dialog/service.js +2 -2
  135. package/components/markdown/markdown.js +2 -2
  136. package/components/message/message.js +2 -2
  137. package/components/old-browsers-message/white-list.js +2 -2
  138. package/components/pager/pager.js +1 -1
  139. package/components/popup/popup.d.ts +2 -0
  140. package/components/popup/popup.js +6 -2
  141. package/components/popup/popup.target.d.ts +3 -2
  142. package/components/popup/popup.target.js +32 -28
  143. package/components/popup-menu/popup-menu.js +1 -1
  144. package/components/query-assist/query-assist-suggestions.js +1 -1
  145. package/components/query-assist/query-assist.d.ts +3 -1
  146. package/components/query-assist/query-assist.js +2 -2
  147. package/components/radio/radio-item.d.ts +3 -3
  148. package/components/radio/radio-item.js +32 -18
  149. package/components/radio/radio.d.ts +2 -2
  150. package/components/radio/radio.js +2 -2
  151. package/components/scrollable-section/scrollable-section.js +1 -1
  152. package/components/select/chevron-button.js +1 -1
  153. package/components/select/select-filter.js +1 -1
  154. package/components/select/select-popup.d.ts +1 -1
  155. package/components/select/select-popup.js +1 -1
  156. package/components/select/select.d.ts +4 -2
  157. package/components/select/select.js +1 -1
  158. package/components/slider/slider.js +100 -96
  159. package/components/storage/storage-local.js +1 -1
  160. package/components/storage/storage.js +1 -1
  161. package/components/style.css +1 -1
  162. package/components/tab-trap/tab-trap.d.ts +3 -3
  163. package/components/tab-trap/tab-trap.js +83 -80
  164. package/components/table/default-item-renderer.d.ts +35 -11
  165. package/components/table/default-item-renderer.js +118 -171
  166. package/components/table/internal/column-animation.d.ts +16 -0
  167. package/components/table/internal/table-header.d.ts +4 -0
  168. package/components/table/internal/virtual-items.d.ts +34 -0
  169. package/components/table/item-virtualization.d.ts +35 -0
  170. package/components/table/item-virtualization.js +71 -0
  171. package/components/table/table-const.d.ts +40 -6
  172. package/components/table/table-const.js +15 -6
  173. package/components/table/table-primitives.d.ts +21 -0
  174. package/components/table/table-primitives.js +123 -0
  175. package/components/table/table-props.d.ts +280 -0
  176. package/components/table/table-props.js +1 -0
  177. package/components/table/table.d.ts +205 -224
  178. package/components/table/table.js +356 -14
  179. package/components/tabs/collapsible-more.js +1 -1
  180. package/components/tabs/collapsible-tab.js +1 -1
  181. package/components/tabs/collapsible-tabs.js +1 -1
  182. package/components/tabs/dumb-tabs.js +1 -1
  183. package/components/tabs/smart-tabs.js +1 -1
  184. package/components/tabs/tab-link.js +1 -1
  185. package/components/tabs/tabs.js +1 -1
  186. package/components/tag/tag.js +1 -1
  187. package/components/tags-input/tags-input.d.ts +3 -1
  188. package/components/tags-input/tags-input.js +1 -1
  189. package/components/tags-list/tags-list.js +1 -1
  190. package/components/toggle/toggle.js +1 -1
  191. package/components/tooltip/tooltip.js +3 -3
  192. package/components/upload/upload.d.ts +4 -3
  193. package/components/upload/upload.js +7 -29
  194. package/components/user-agreement/service.js +8 -8
  195. package/components/user-agreement/user-agreement.js +1 -1
  196. package/components/user-card/card.js +1 -1
  197. package/components/user-card/smart-user-card-tooltip.js +1 -1
  198. package/components/user-card/tooltip.js +1 -1
  199. package/components/user-card/user-card.js +1 -1
  200. package/components/util-stories.d.ts +26 -0
  201. package/package.json +7 -7
  202. package/components/_helpers/table2.js +0 -3
  203. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  204. package/components/date-picker/use-intersection-observer.js +0 -93
  205. package/components/global/composeRefs.d.ts +0 -6
  206. package/components/global/composeRefs.js +0 -9
  207. package/components/global/use-event-callback.d.ts +0 -1
  208. package/components/global/use-event-callback.js +0 -44
  209. package/components/table/table-base.d.ts +0 -24
  210. package/components/table/table-base.js +0 -311
  211. package/components/table/table-component.d.ts +0 -53
  212. package/components/table/table-component.js +0 -316
  213. package/components/table/table-virtualize.d.ts +0 -32
  214. package/components/table/table-virtualize.js +0 -330
@@ -0,0 +1,123 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import classNames from 'classnames';
3
+ import { s as styles } from '../_helpers/table.js';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ const keyboardFocusableAttrName = 'data-keyboard-focusable';
7
+ /**
8
+ * A helper `<tr>` component for custom {@link TableProps.renderItem} implementations.
9
+ * Applies the standard row class names.
10
+ */
11
+ function TableRow(props) {
12
+ const $ = c(13);
13
+ if ($[0] !== "cabc2a5dbbf0c25c3facc4244a2cfb0e9361a7af6c622110f3bd4ba41a3d1955") {
14
+ for (let $i = 0; $i < 13; $i += 1) {
15
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
16
+ }
17
+ $[0] = "cabc2a5dbbf0c25c3facc4244a2cfb0e9361a7af6c622110f3bd4ba41a3d1955";
18
+ }
19
+ let className;
20
+ let keyboardFocusable;
21
+ let restProps;
22
+ if ($[1] !== props) {
23
+ ({
24
+ keyboardFocusable,
25
+ className,
26
+ ...restProps
27
+ } = props);
28
+ $[1] = props;
29
+ $[2] = className;
30
+ $[3] = keyboardFocusable;
31
+ $[4] = restProps;
32
+ } else {
33
+ className = $[2];
34
+ keyboardFocusable = $[3];
35
+ restProps = $[4];
36
+ }
37
+ let t0;
38
+ if ($[5] !== className) {
39
+ t0 = classNames(styles.row, className);
40
+ $[5] = className;
41
+ $[6] = t0;
42
+ } else {
43
+ t0 = $[6];
44
+ }
45
+ const classes = t0;
46
+ let t1;
47
+ if ($[7] !== keyboardFocusable || $[8] !== restProps) {
48
+ t1 = keyboardFocusable ? {
49
+ [keyboardFocusableAttrName]: "",
50
+ ...restProps
51
+ } : restProps;
52
+ $[7] = keyboardFocusable;
53
+ $[8] = restProps;
54
+ $[9] = t1;
55
+ } else {
56
+ t1 = $[9];
57
+ }
58
+ const trRestProps = t1;
59
+ let t2;
60
+ if ($[10] !== classes || $[11] !== trRestProps) {
61
+ t2 = /*#__PURE__*/jsx("tr", {
62
+ className: classes,
63
+ ...trRestProps
64
+ });
65
+ $[10] = classes;
66
+ $[11] = trRestProps;
67
+ $[12] = t2;
68
+ } else {
69
+ t2 = $[12];
70
+ }
71
+ return t2;
72
+ }
73
+ /**
74
+ * A helper `<td>` component for custom {@link TableProps.renderItem} implementations.
75
+ * Applies the standard cell class names, but not data-dependent `tdClassName`.
76
+ */
77
+ function TableCell(props) {
78
+ const $ = c(9);
79
+ if ($[0] !== "cabc2a5dbbf0c25c3facc4244a2cfb0e9361a7af6c622110f3bd4ba41a3d1955") {
80
+ for (let $i = 0; $i < 9; $i += 1) {
81
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
82
+ }
83
+ $[0] = "cabc2a5dbbf0c25c3facc4244a2cfb0e9361a7af6c622110f3bd4ba41a3d1955";
84
+ }
85
+ let className;
86
+ let restProps;
87
+ if ($[1] !== props) {
88
+ ({
89
+ className,
90
+ ...restProps
91
+ } = props);
92
+ $[1] = props;
93
+ $[2] = className;
94
+ $[3] = restProps;
95
+ } else {
96
+ className = $[2];
97
+ restProps = $[3];
98
+ }
99
+ let t0;
100
+ if ($[4] !== className) {
101
+ t0 = classNames(styles.cell, className);
102
+ $[4] = className;
103
+ $[5] = t0;
104
+ } else {
105
+ t0 = $[5];
106
+ }
107
+ const classes = t0;
108
+ let t1;
109
+ if ($[6] !== classes || $[7] !== restProps) {
110
+ t1 = /*#__PURE__*/jsx("td", {
111
+ className: classes,
112
+ ...restProps
113
+ });
114
+ $[6] = classes;
115
+ $[7] = restProps;
116
+ $[8] = t1;
117
+ } else {
118
+ t1 = $[8];
119
+ }
120
+ return t1;
121
+ }
122
+
123
+ export { TableCell, TableRow, keyboardFocusableAttrName };
@@ -0,0 +1,280 @@
1
+ import type { AriaAttributes, ReactNode, RefObject } from 'react';
2
+ export interface TableProps<T> {
3
+ /**
4
+ * The data items to render. `null` and `undefined` items are not supported.
5
+ * Referentially identical items are not supported either.
6
+ */
7
+ data: readonly T[];
8
+ /**
9
+ * Column definitions.
10
+ */
11
+ columns: readonly Column<T>[];
12
+ /**
13
+ * Used as a key in the items list.
14
+ */
15
+ getKey: (item: T, index: number, items: readonly T[]) => React.Key;
16
+ /**
17
+ * If `true`, the table header will not be rendered.
18
+ *
19
+ * Note that this may impact accessibility. If necessary, provide additional
20
+ * information via `aria-label` or `aria-description` on the `Table` element.
21
+ */
22
+ noHeader?: boolean;
23
+ /**
24
+ * If true, renders a sticky header.
25
+ */
26
+ stickyHeader?: boolean;
27
+ /**
28
+ * Called when the user clicks the sort button in a column header.
29
+ * The client is expected to update the `columns` prop with the new
30
+ * sort order for the corresponding column, and update the data accordingly.
31
+ */
32
+ onSort?: (columnIndex: number, newOrder: SortOrder, columns: readonly Column<T>[]) => void;
33
+ /**
34
+ * Called when the user clicks on a column delete button in the header.
35
+ * The client is expected to update the `columns` prop with the column removed.
36
+ */
37
+ onColumnDelete?: (columnIndex: number, columns: readonly Column<T>[]) => void;
38
+ /**
39
+ * Called when the user reorders columns by dragging a column.
40
+ * The `insertionIndex` parameter represents an insertion position in the original,
41
+ * unchanged `columns` array before the column is removed.
42
+ *
43
+ * One possible implementation is:
44
+ *
45
+ * ```ts
46
+ * const [moved] = columns.splice(fromIndex, 1);
47
+ * columns.splice(fromIndex < insertionIndex ? insertionIndex - 1 : insertionIndex, 0, moved);
48
+ * ```
49
+ *
50
+ * The callback is not called when the reorder operation would not change the
51
+ * column order, i.e. when
52
+ * `insertionIndex === fromIndex || insertionIndex === fromIndex + 1`.
53
+ */
54
+ onColumnReorder?: (fromIndex: number, insertionIndex: number, columns: readonly Column<T>[]) => void;
55
+ /**
56
+ * By default, when a column is reordered, the moved column is highlighted
57
+ * with a temporary background color. Set `true` to disable this animation.
58
+ */
59
+ noColumnReorderAnimation?: boolean;
60
+ /**
61
+ * Customizes how an item is rendered.
62
+ *
63
+ * Return `DefaultItemRenderer` to configure row-specific behavior such as
64
+ * `clickable`, `keyboardFocusable`, event handlers, `className`, or `ref`.
65
+ *
66
+ * You can also return custom row(s) instead. See the `Table` documentation
67
+ * for details.
68
+ */
69
+ renderItem?: (item: T, index: number, items: readonly T[]) => ReactNode;
70
+ /**
71
+ * Only renders rows near the viewport.
72
+ *
73
+ * Rows may transition between two states:
74
+ * - materialized: rendered as actual table rows. This happens when
75
+ * the corresponding spacer approaches the viewport, as specified by
76
+ * `lookaheadPx`.
77
+ * - virtualized: replaced with spacer rows of the same height. This happens
78
+ * when the row moves sufficiently far from the viewport, as specified by
79
+ * `retentionMarginPx`.
80
+ *
81
+ * Toggling this prop should normally work as expected, but a seamless
82
+ * transition is not guaranteed: the scroll position may reset to the top.
83
+ * However, if row height estimates are accurate and the data has not
84
+ * changed, the browser may apply scroll anchoring, resulting in a smoother
85
+ * transition, possibly with brief flickering but without scroll jumps.
86
+ */
87
+ virtualizeRows?: boolean;
88
+ /**
89
+ * Used with `virtualizeRows` as the source of scroll events, the target of
90
+ * `ResizeObserver`, and the root of `IntersectionObserver`. Required when
91
+ * the scrollable container is not the whole document.
92
+ *
93
+ * If not set:
94
+ * - the scroll listener is attached to `window`
95
+ * - `ResizeObserver` observes `document.body`
96
+ * - `IntersectionObserver` has no root (i.e. the viewport is used)
97
+ *
98
+ * Note that if this scroller is nested inside another scrollable container,
99
+ * the outer container is not tracked. As a result, items may not materialize
100
+ * until the inner scroller is scrolled.
101
+ *
102
+ * Support for nested scroll containers may be added in the future.
103
+ */
104
+ scrollerRef?: RefObject<HTMLElement | null>;
105
+ /**
106
+ * Used with `virtualizeRows` to estimate the height of items that have not
107
+ * been rendered yet. The function should be fast and side-effect free.
108
+ * Do not measure the DOM here. Once a row is rendered, its actual height
109
+ * will be measured and used instead of this estimate.
110
+ *
111
+ * Note the effects of imprecise estimates:
112
+ * - When the height is underestimated, the table may materialize more rows
113
+ * than specified by `lookaheadPx`. If the resulting rows extend beyond
114
+ * `retentionMarginPx`, they will be virtualized again. If this causes
115
+ * relayout flickering, increase `retentionMarginPx`.
116
+ * - When the height is overestimated, the table may materialize fewer rows
117
+ * than specified by `lookaheadPx`, which may leave a spacer partially
118
+ * visible. To avoid this, increase `lookaheadPx` (and `retentionMarginPx`
119
+ * accordingly, since it should be greater than `lookaheadPx`).
120
+ *
121
+ * Default: 37px = 16px padding + 20px line height + 1px border.
122
+ */
123
+ estimateHeight?: (item: T, index: number, items: readonly T[]) => number;
124
+ /**
125
+ * When using `virtualizeRows`, the number of pixels above and below
126
+ * the viewport to materialize in advance.
127
+ *
128
+ * Increase this value if blank space becomes visible during fast scrolling.
129
+ *
130
+ * Default: 400px.
131
+ */
132
+ lookaheadPx?: number;
133
+ /**
134
+ * Used with `virtualizeRows`. Additional margin around the viewport before
135
+ * materialized rows become eligible for virtualization.
136
+ *
137
+ * Increasing this value reduces row churn when heights are underestimated.
138
+ * In that case, the table may materialize more rows than needed and then
139
+ * immediately virtualize them again. A larger margin keeps such rows
140
+ * rendered for longer, at the cost of rendering more rows overall.
141
+ *
142
+ * This value should be greater than `lookaheadPx`. Increase it if you notice
143
+ * table relayouts during initial render or scrolling.
144
+ *
145
+ * Default: 450px.
146
+ */
147
+ retentionMarginPx?: number;
148
+ /**
149
+ * When using `virtualizeRows`, ignore scroll and resize position changes
150
+ * smaller than this value.
151
+ *
152
+ * Measurement inaccuracies and rounding artifacts may slightly change the
153
+ * table layout during materialization and virtualization. With scroll
154
+ * anchoring enabled (the default browser behavior), the browser may then
155
+ * adjust the scroll position, triggering additional scroll or resize events.
156
+ * Small deltas are ignored to prevent such feedback loops from causing
157
+ * oscillations at virtualization boundaries.
158
+ *
159
+ * Increase if you expect high inaccuracy in height measurements, or if you
160
+ * notice oscillations at virtualization boundaries.
161
+ *
162
+ * Default: 50px.
163
+ */
164
+ minScrollAndResizeDeltaPx?: number;
165
+ /**
166
+ * "Column editing mode" is a mode in which controls that are normally hidden
167
+ * become visible, such as column reorder and delete buttons.
168
+ *
169
+ * When this prop is `undefined`, the component manages the mode internally.
170
+ * Users can toggle it by tapping the table header on mobile or by clicking
171
+ * the column edit button, if enabled. Since tapping the table header is not
172
+ * discoverable by assistive technologies, it's recommended to enable
173
+ * `columnEditButton` when using the internal mode.
174
+ *
175
+ * Alternatively, pass `true` or `false` to control the mode externally.
176
+ */
177
+ columnEditing?: boolean;
178
+ /**
179
+ * Called when the user requests to enter or leave column editing mode.
180
+ *
181
+ * The `source` parameter indicates what triggered the request.
182
+ *
183
+ * When `columnEditing` is not controlled, the component automatically
184
+ * applies the requested change internally.
185
+ *
186
+ * When `columnEditing` is controlled externally and you still want to
187
+ * respond to user requests, use this callback to decide whether to
188
+ * update the mode.
189
+ */
190
+ onColumnEditingRequest?: (editing: boolean, source: 'header' | 'edit-button') => void;
191
+ /**
192
+ * Whether to show a small gear button in the top-right corner that
193
+ * toggles column editing mode.
194
+ *
195
+ * For accessibility, it's recommended to enable this button unless you
196
+ * provide an external control for toggling column editing mode.
197
+ */
198
+ columnEditButton?: boolean;
199
+ /**
200
+ * Applied to the `<thead>` element.
201
+ */
202
+ theadClassName?: string;
203
+ /**
204
+ * Applied to the only `<tr>` element within the `<thead>`.
205
+ */
206
+ theadTrClassName?: string;
207
+ /**
208
+ * Applied to the `<tbody>` element.
209
+ */
210
+ tbodyClassName?: string;
211
+ }
212
+ export type SortOrder = Extract<AriaAttributes['aria-sort'], 'none' | 'ascending' | 'descending'>;
213
+ /**
214
+ * The column specification.
215
+ */
216
+ export interface Column<T> {
217
+ /**
218
+ * Used as a key in the columns list.
219
+ */
220
+ key: React.Key;
221
+ /**
222
+ * Used in `aria-label`s of column controls which do not contain text,
223
+ * such as the delete column button. If not set, the `String(key)` is used.
224
+ */
225
+ name?: string;
226
+ /**
227
+ * Renders the content of the column header, excluding controls such as
228
+ * the sort and delete buttons. If not specified, the default behavior is
229
+ * `name ?? String(key)`.
230
+ */
231
+ renderHeader?: () => ReactNode;
232
+ /**
233
+ * Renders the value of a single cell. If not specified, the default
234
+ * behavior is:
235
+ *
236
+ * - If `item` is an `Array`, renders `String(item[columnIndex])`
237
+ * - If `item` is an `Object`, renders `String(item[String(columnKey)])`
238
+ * - Otherwise:
239
+ * - The first column renders `String(item)`
240
+ * - Other columns render an empty string
241
+ */
242
+ renderCell?: (item: T, index: number, items: readonly T[]) => ReactNode;
243
+ /**
244
+ * If the column gets an indent when `DefaultItemRendererProps.level` returns
245
+ * a positive number.
246
+ */
247
+ indent?: boolean;
248
+ /**
249
+ * If set, displays sort button and includes `aria-sort` in the column header.
250
+ * Handle clicks with {@link TableProps.onSort}.
251
+ */
252
+ sortOrder?: AriaAttributes['aria-sort'];
253
+ /**
254
+ * Whether to display a delete button in the column header.
255
+ * Handle delete requests with {@link TableProps.onColumnDelete}.
256
+ * Make sure {@link Column.name} or {@link Column.key} is meaningful,
257
+ * as it will be included in the `aria-label` of the delete button.
258
+ */
259
+ deletable?: boolean;
260
+ /**
261
+ * Displays a reorder handle in the column header.
262
+ * Handle reorder requests with {@link TableProps.onColumnReorder}.
263
+ * If a function is provided, it determines whether the column may be moved
264
+ * to the specified insertion position.
265
+ *
266
+ * Make sure {@link Column.name} or {@link Column.key} is meaningful,
267
+ * as it will be included in the `aria-label` of the reorder button.
268
+ */
269
+ canReorder?: boolean | ((insertionIndex: number, columns: readonly Column<T>[]) => boolean);
270
+ /**
271
+ * The class name to apply to the `th` element inside `table > thead`.
272
+ */
273
+ thClassName?: string;
274
+ /**
275
+ * The class name to apply to the `td` element inside `table > tbody`.
276
+ * If a custom `TableProps.renderItem` is provided, this prop is not used,
277
+ * unless the custom renderer falls back to the `DefaultItemRenderer`.
278
+ */
279
+ tdClassName?: string | ((item: T, index: number, items: readonly T[]) => string | undefined);
280
+ }
@@ -0,0 +1 @@
1
+