@jetbrains/ring-ui-built 7.0.124 → 8.0.0-beta.10

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 (262) hide show
  1. package/components/_helpers/anchor.js +1 -1
  2. package/components/_helpers/avatar-info.js +3 -5
  3. package/components/_helpers/caption.js +1 -1
  4. package/components/_helpers/icon-svg.js +37 -52
  5. package/components/_helpers/legacy-table.js +3 -0
  6. package/components/_helpers/tab-link.js +1 -1
  7. package/components/_helpers/table.js +2 -2
  8. package/components/_helpers/theme.js +49 -37
  9. package/components/alert/alert-actions.js +1 -1
  10. package/components/alert/alert-heading.js +1 -1
  11. package/components/alert/alert.js +2 -2
  12. package/components/alert-service/alert-service.js +2 -2
  13. package/components/auth/auth-core.js +2 -2
  14. package/components/auth/auth.js +2 -2
  15. package/components/auth/down-notification.js +2 -2
  16. package/components/auth/iframe-flow.js +1 -1
  17. package/components/auth/storage.js +2 -2
  18. package/components/auth-dialog/auth-dialog.js +2 -2
  19. package/components/auth-dialog-service/auth-dialog-service.js +2 -2
  20. package/components/avatar/avatar-info.js +1 -1
  21. package/components/avatar/avatar-size.d.ts +0 -4
  22. package/components/avatar/avatar-size.js +0 -4
  23. package/components/avatar/avatar.js +1 -8
  24. package/components/avatar/fallback-avatar.js +3 -48
  25. package/components/avatar-stack/avatar-stack.js +5 -5
  26. package/components/banner/banner.js +2 -2
  27. package/components/button/button.d.ts +0 -4
  28. package/components/button/button.js +4 -10
  29. package/components/button-group/button-group.js +1 -1
  30. package/components/button-toolbar/button-toolbar.js +1 -1
  31. package/components/checkbox/checkbox.d.ts +1 -1
  32. package/components/checkbox/checkbox.js +1 -2
  33. package/components/clipboard/clipboard.js +2 -2
  34. package/components/collapse/collapse-content.js +35 -43
  35. package/components/collapse/collapse-context.d.ts +1 -0
  36. package/components/collapse/collapse-context.js +1 -0
  37. package/components/collapse/collapse-control.js +5 -5
  38. package/components/collapse/collapse.js +34 -25
  39. package/components/collapsible-group/collapsible-group.d.ts +5 -1
  40. package/components/collapsible-group/collapsible-group.js +80 -98
  41. package/components/components/util-stories.js +63 -1
  42. package/components/confirm/confirm.js +2 -2
  43. package/components/confirm-service/confirm-service.js +4 -4
  44. package/components/contenteditable/contenteditable.js +4 -5
  45. package/components/control-help/control-help.js +1 -1
  46. package/components/control-label/control-label.js +1 -1
  47. package/components/data-list/data-list.d.ts +4 -4
  48. package/components/data-list/data-list.js +5 -5
  49. package/components/data-list/data-list.mock.d.ts +1 -1
  50. package/components/data-list/data-list.mock.js +2 -2
  51. package/components/data-list/item.d.ts +1 -1
  52. package/components/data-list/item.js +3 -3
  53. package/components/data-list/selection.d.ts +1 -1
  54. package/components/data-list/selection.js +2 -2
  55. package/components/data-list/title.js +1 -2
  56. package/components/date-picker/date-input.js +2 -2
  57. package/components/date-picker/date-picker.js +2 -3
  58. package/components/date-picker/date-popup.js +4 -5
  59. package/components/date-picker/month-names.js +1 -1
  60. package/components/date-picker/month-slider.js +1 -1
  61. package/components/date-picker/month.d.ts +0 -2
  62. package/components/date-picker/month.js +17 -18
  63. package/components/date-picker/months.js +43 -36
  64. package/components/date-picker/use-scroll-behavior.js +45 -45
  65. package/components/date-picker/weekdays.js +1 -1
  66. package/components/date-picker/years.js +61 -55
  67. package/components/dialog/dialog.d.ts +2 -2
  68. package/components/dialog/dialog.js +5 -5
  69. package/components/dropdown/anchor.js +3 -3
  70. package/components/dropdown/dropdown.js +3 -3
  71. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  72. package/components/dropdown-menu/dropdown-menu.js +63 -58
  73. package/components/editable-heading/editable-heading.d.ts +1 -2
  74. package/components/editable-heading/editable-heading.js +14 -13
  75. package/components/error-bubble/error-bubble.js +1 -1
  76. package/components/error-message/error-message.js +1 -2
  77. package/components/footer/footer.js +1 -1
  78. package/components/global/compose-refs.d.ts +2 -1
  79. package/components/global/compose-refs.js +44 -8
  80. package/components/global/configuration.d.ts +0 -5
  81. package/components/global/configuration.js +2 -10
  82. package/components/global/controls-height.js +1 -1
  83. package/components/global/create-stateful-context.js +11 -11
  84. package/components/global/focus-sensor-hoc.js +1 -0
  85. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  86. package/components/global/focus-with-temporary-tabindex.js +23 -0
  87. package/components/global/intersection-observer-context.d.ts +46 -0
  88. package/components/global/intersection-observer-context.js +138 -0
  89. package/components/global/is-within-interactive-element.d.ts +6 -0
  90. package/components/global/is-within-interactive-element.js +11 -0
  91. package/components/global/is-within-navigable-element.d.ts +6 -0
  92. package/components/global/is-within-navigable-element.js +11 -0
  93. package/components/global/parse-css-duration.d.ts +5 -0
  94. package/components/global/parse-css-duration.js +14 -0
  95. package/components/global/rerender-hoc.d.ts +4 -2
  96. package/components/global/rerender-hoc.js +11 -24
  97. package/components/global/schedule-with-cleanup.d.ts +12 -0
  98. package/components/global/schedule-with-cleanup.js +36 -0
  99. package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
  100. package/components/{table/selection.js → global/table-selection.js} +5 -5
  101. package/components/global/theme.d.ts +4 -3
  102. package/components/global/theme.js +1 -1
  103. package/components/global/variables.interface.d.ts +0 -4
  104. package/components/header/header-icon.js +3 -3
  105. package/components/header/header.js +3 -3
  106. package/components/header/links.js +1 -1
  107. package/components/header/logo.js +1 -2
  108. package/components/header/profile.js +5 -5
  109. package/components/header/services.js +3 -3
  110. package/components/header/smart-profile.js +3 -3
  111. package/components/header/smart-services.js +3 -3
  112. package/components/heading/heading.js +1 -1
  113. package/components/i18n/i18n-context.js +4 -4
  114. package/components/icon/icon-svg.js +1 -2
  115. package/components/icon/icon.d.ts +0 -1
  116. package/components/icon/icon.js +2 -6
  117. package/components/icon/index.js +1 -2
  118. package/components/input/input.d.ts +1 -1
  119. package/components/input/input.js +3 -3
  120. package/components/internal/reorder-animation-context.js +159 -0
  121. package/components/internal/reorder-handle.js +750 -0
  122. package/components/internal/reorder-layout-context.js +141 -0
  123. package/components/internal/table-header.js +685 -0
  124. package/components/internal/virtualization.js +368 -0
  125. package/components/island/adaptive-island-hoc.js +3 -3
  126. package/components/island/content.d.ts +7 -2
  127. package/components/island/content.js +27 -18
  128. package/components/island/header.js +1 -1
  129. package/components/island/island.js +1 -1
  130. package/components/{table → legacy-table}/cell.js +1 -1
  131. package/components/{table → legacy-table}/header-cell.js +2 -3
  132. package/components/{table → legacy-table}/header.js +2 -3
  133. package/components/{table → legacy-table}/multitable.d.ts +1 -1
  134. package/components/{table → legacy-table}/row-with-focus-sensor.js +3 -3
  135. package/components/{table → legacy-table}/row.d.ts +1 -1
  136. package/components/{table → legacy-table}/row.js +5 -5
  137. package/components/legacy-table/selection-adapter.d.ts +6 -0
  138. package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
  139. package/components/{table → legacy-table}/simple-table.d.ts +2 -2
  140. package/components/{table → legacy-table}/simple-table.js +5 -5
  141. package/components/{table → legacy-table}/smart-table.d.ts +5 -5
  142. package/components/{table → legacy-table}/smart-table.js +6 -6
  143. package/components/legacy-table/table.d.ts +109 -0
  144. package/components/legacy-table/table.js +369 -0
  145. package/components/list/consts.d.ts +0 -1
  146. package/components/list/consts.js +0 -1
  147. package/components/list/list-item.js +3 -5
  148. package/components/list/list-users-groups-source.js +1 -2
  149. package/components/list/list.d.ts +0 -4
  150. package/components/list/list.js +1 -2
  151. package/components/login-dialog/login-dialog.js +3 -3
  152. package/components/login-dialog/service.js +2 -2
  153. package/components/message/message.js +1 -1
  154. package/components/pager/pager.js +3 -3
  155. package/components/popup/popup.js +1 -1
  156. package/components/popup/popup.target.d.ts +3 -2
  157. package/components/popup/popup.target.js +32 -28
  158. package/components/popup-menu/popup-menu.js +1 -1
  159. package/components/query-assist/query-assist-suggestions.js +1 -2
  160. package/components/query-assist/query-assist.d.ts +3 -1
  161. package/components/query-assist/query-assist.js +2 -2
  162. package/components/radio/radio-item.d.ts +3 -3
  163. package/components/radio/radio-item.js +33 -19
  164. package/components/radio/radio.d.ts +2 -2
  165. package/components/radio/radio.js +2 -2
  166. package/components/scrollable-section/scrollable-section.js +1 -1
  167. package/components/select/chevron-button.js +3 -3
  168. package/components/select/select-filter.js +3 -3
  169. package/components/select/select-popup.d.ts +3 -2
  170. package/components/select/select-popup.js +9 -4
  171. package/components/select/select.d.ts +6 -2
  172. package/components/select/select.js +5 -4
  173. package/components/selection-toolbar/selection-toolbar.d.ts +11 -0
  174. package/components/selection-toolbar/selection-toolbar.js +200 -0
  175. package/components/slider/slider.js +100 -97
  176. package/components/storage/storage-local.js +2 -2
  177. package/components/storage/storage.js +2 -2
  178. package/components/style.css +1 -1
  179. package/components/tab-trap/tab-trap.d.ts +3 -3
  180. package/components/tab-trap/tab-trap.js +83 -80
  181. package/components/table/default-item-renderer.d.ts +55 -0
  182. package/components/table/default-item-renderer.js +240 -0
  183. package/components/table/internal/reorder-animation-context.d.ts +21 -0
  184. package/components/table/internal/reorder-handle.d.ts +9 -0
  185. package/components/table/internal/reorder-layout-context.d.ts +16 -0
  186. package/components/table/internal/table-header.d.ts +1 -0
  187. package/components/table/internal/virtualization.d.ts +41 -0
  188. package/components/table/item-virtualization.d.ts +37 -0
  189. package/components/table/item-virtualization.js +73 -0
  190. package/components/table/reorder-animation.d.ts +37 -0
  191. package/components/table/reorder-animation.js +18 -0
  192. package/components/table/reorder-item-layout.d.ts +32 -0
  193. package/components/table/reorder-item-layout.js +57 -0
  194. package/components/table/table-const.d.ts +10 -0
  195. package/components/table/table-const.js +13 -0
  196. package/components/table/table-primitives.d.ts +64 -0
  197. package/components/table/table-primitives.js +180 -0
  198. package/components/table/table-props.d.ts +304 -0
  199. package/components/table/table-props.js +1 -0
  200. package/components/table/table.d.ts +231 -107
  201. package/components/table/table.js +351 -346
  202. package/components/tabs/collapsible-more.js +1 -1
  203. package/components/tabs/collapsible-tab.js +1 -1
  204. package/components/tabs/collapsible-tabs.js +1 -1
  205. package/components/tabs/dumb-tabs.js +1 -1
  206. package/components/tabs/smart-tabs.js +1 -1
  207. package/components/tabs/tab-link.js +1 -1
  208. package/components/tabs/tabs.js +1 -1
  209. package/components/tag/tag.js +1 -1
  210. package/components/tags-input/tags-input.d.ts +3 -1
  211. package/components/tags-input/tags-input.js +4 -4
  212. package/components/tags-list/tags-list.js +2 -2
  213. package/components/toggle/toggle.js +1 -1
  214. package/components/tooltip/tooltip.d.ts +2 -1
  215. package/components/tooltip/tooltip.js +5 -3
  216. package/components/upload/upload.d.ts +4 -3
  217. package/components/upload/upload.js +7 -30
  218. package/components/user-agreement/service.js +3 -3
  219. package/components/user-agreement/user-agreement.js +2 -2
  220. package/components/user-card/card.js +4 -4
  221. package/components/user-card/smart-user-card-tooltip.js +3 -3
  222. package/components/user-card/tooltip.js +3 -3
  223. package/components/user-card/user-card.js +5 -5
  224. package/components/util-stories.d.ts +26 -0
  225. package/package.json +8 -9
  226. package/components/__mocks__/old-browsers-message.js +0 -3
  227. package/components/_helpers/grid.js +0 -3
  228. package/components/_helpers/sidebar.js +0 -110
  229. package/components/content-layout/content-layout.d.ts +0 -20
  230. package/components/content-layout/content-layout.js +0 -50
  231. package/components/content-layout/sidebar.d.ts +0 -26
  232. package/components/content-layout/sidebar.js +0 -5
  233. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  234. package/components/date-picker/use-intersection-observer.js +0 -93
  235. package/components/expand/collapsible-group.d.ts +0 -8
  236. package/components/expand/collapsible-group.js +0 -52
  237. package/components/global/composeRefs.d.ts +0 -6
  238. package/components/global/composeRefs.js +0 -9
  239. package/components/global/use-event-callback.d.ts +0 -4
  240. package/components/global/use-event-callback.js +0 -49
  241. package/components/grid/col.d.ts +0 -16
  242. package/components/grid/col.js +0 -63
  243. package/components/grid/grid.d.ts +0 -13
  244. package/components/grid/grid.js +0 -27
  245. package/components/grid/row.d.ts +0 -21
  246. package/components/grid/row.js +0 -72
  247. package/components/old-browsers-message/old-browsers-message-stop.d.ts +0 -1
  248. package/components/old-browsers-message/old-browsers-message-stop.js +0 -5
  249. package/components/old-browsers-message/old-browsers-message.d.ts +0 -5
  250. package/components/old-browsers-message/old-browsers-message.js +0 -89
  251. package/components/old-browsers-message/white-list.d.ts +0 -2
  252. package/components/old-browsers-message/white-list.js +0 -30
  253. package/components/table/selection-adapter.d.ts +0 -6
  254. /package/components/{table → legacy-table}/cell.d.ts +0 -0
  255. /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
  256. /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
  257. /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
  258. /package/components/{table → legacy-table}/header.d.ts +0 -0
  259. /package/components/{table → legacy-table}/multitable.js +0 -0
  260. /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
  261. /package/components/{table → legacy-table}/selection-adapter.js +0 -0
  262. /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
@@ -0,0 +1,16 @@
1
+ interface ItemBounds {
2
+ start: number;
3
+ end: number;
4
+ }
5
+ export interface InsertionPoint {
6
+ itemIndex: number;
7
+ after: boolean;
8
+ }
9
+ interface ReorderLayoutContextValue {
10
+ registerReorderItem(index: number, getBounds: () => ItemBounds): () => void;
11
+ getItemBounds(index: number): ItemBounds | undefined;
12
+ getClosestInsertionPoint(clientOffset: number, canReorder: (insertionIndex: number) => boolean): InsertionPoint | undefined;
13
+ }
14
+ export declare const ReorderLayoutContext: import("react").Context<ReorderLayoutContextValue>;
15
+ export declare function useReorderLayoutContextValue(): ReorderLayoutContextValue;
16
+ export {};
@@ -0,0 +1 @@
1
+ export declare function TableHeader<T>(): import("react").JSX.Element | null;
@@ -0,0 +1,41 @@
1
+ import { type RefObject } from 'react';
2
+ import { type IntersectionObserverHandle } from '../../global/intersection-observer-context';
3
+ export type VirtualItem = MaterializedItem | Spacer;
4
+ interface MaterializedItem {
5
+ type: 'materialized';
6
+ index: number;
7
+ }
8
+ interface Spacer {
9
+ type: 'spacer';
10
+ from: number;
11
+ to: number;
12
+ height: number;
13
+ key: string;
14
+ }
15
+ type CollapseItemIntoSpacerCallback = (index: number, height: number) => void;
16
+ interface VirtualizationContextValue {
17
+ intersectionObserverHandle: IntersectionObserverHandle;
18
+ collapseItemIntoSpacer: CollapseItemIntoSpacerCallback;
19
+ }
20
+ export declare const VirtualizationContext: import("react").Context<VirtualizationContextValue>;
21
+ export declare function useVirtualItems<T>({ enabled, data, data: { length }, scrollerRef, tableRef, estimateHeight, lookaheadPx, retentionMarginPx, minScrollAndResizeDeltaPx, }: {
22
+ enabled: boolean;
23
+ data: readonly T[];
24
+ scrollerRef: RefObject<HTMLElement | null> | undefined;
25
+ tableRef: RefObject<HTMLTableElement | null>;
26
+ estimateHeight: (item: T, index: number, items: readonly T[]) => number;
27
+ lookaheadPx: number;
28
+ retentionMarginPx: number;
29
+ minScrollAndResizeDeltaPx: number;
30
+ }): {
31
+ virtualItems: VirtualItem[];
32
+ virtualizationContextValue: {
33
+ intersectionObserverHandle: IntersectionObserverHandle;
34
+ collapseItemIntoSpacer: (index: number, height: number) => void;
35
+ };
36
+ };
37
+ export declare function SpacerRow({ spacer: { from, to, height }, colSpan }: {
38
+ spacer: Spacer;
39
+ colSpan: number;
40
+ }): import("react").JSX.Element;
41
+ export {};
@@ -0,0 +1,37 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * Use in an item renderer to control item virtualization.
4
+ */
5
+ export declare function useItemVirtualization({ index, refs, onIntersectionChange, }: {
6
+ /**
7
+ * Index of the item.
8
+ */
9
+ index: number;
10
+ /**
11
+ * One or more elements representing this item.
12
+ *
13
+ * When multiple elements are provided, the virtualization callback receives
14
+ * the intersection state of all of them.
15
+ *
16
+ * If you pass multiple refs, pass a stable array reference to avoid restarting
17
+ * observation on every render — for example, memoize it with `useMemo()`,
18
+ * unless you use the React Compiler.
19
+ */
20
+ refs: RefObject<HTMLElement | null> | RefObject<HTMLElement | null>[];
21
+ /**
22
+ * Invoked when the `isIntersecting` state of the observed elements changes.
23
+ * Pass a stable function reference to avoid restarting observation on every render —
24
+ * for example, wrap it with `useCallback()`, unless you use the React Compiler.
25
+ *
26
+ * @param intersectionStates - Current intersection state of every observed element.
27
+ * Entries are initially `undefined` until the corresponding element
28
+ * has been reported by `IntersectionObserver`.
29
+ * @param changedIndex - Index of the element whose intersection state changed.
30
+ * @param elements - The observed elements. Note that some elements may
31
+ * already be disconnected from the DOM when this callback is invoked.
32
+ * Use additional checks like `element.isConnected`.
33
+ * @returns Return the height of an item to collapse the item into spacer,
34
+ * or `undefined` to keep the item rendered.
35
+ */
36
+ onIntersectionChange: (intersectionStates: (boolean | undefined)[], changedIndex: number, elements: (Element | null)[]) => number | undefined;
37
+ }): void;
@@ -0,0 +1,73 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { use, useEffect } from 'react';
3
+ import { VirtualizationContext } from '../internal/virtualization.js';
4
+ import '../global/intersection-observer-context.js';
5
+ import '../global/schedule-with-cleanup.js';
6
+ import '../_helpers/table.js';
7
+ import 'react/jsx-runtime';
8
+
9
+ /**
10
+ * Use in an item renderer to control item virtualization.
11
+ */
12
+ function useItemVirtualization(t0) {
13
+ const $ = c(8);
14
+ if ($[0] !== "28d3fc0a1c743c2e72a27a83caad5b78c5438f38b7abdd065da2a832e4f9fcec") {
15
+ for (let $i = 0; $i < 8; $i += 1) {
16
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
17
+ }
18
+ $[0] = "28d3fc0a1c743c2e72a27a83caad5b78c5438f38b7abdd065da2a832e4f9fcec";
19
+ }
20
+ const {
21
+ index,
22
+ refs,
23
+ onIntersectionChange
24
+ } = t0;
25
+ const {
26
+ intersectionObserverHandle,
27
+ collapseItemIntoSpacer
28
+ } = use(VirtualizationContext);
29
+ let t1;
30
+ let t2;
31
+ if ($[1] !== collapseItemIntoSpacer || $[2] !== index || $[3] !== intersectionObserverHandle || $[4] !== onIntersectionChange || $[5] !== refs) {
32
+ t1 = () => {
33
+ const intersectionStates = Array.isArray(refs) ? refs.map(_temp) : [undefined];
34
+ const elements = Array.isArray(refs) ? refs.map(_temp2) : [refs.current];
35
+ const cleanups = [];
36
+ elements.forEach((element, elementIndex) => {
37
+ if (!element) {
38
+ return;
39
+ }
40
+ const cleanup = intersectionObserverHandle.observe(element, isIntersecting => {
41
+ intersectionStates[elementIndex] = isIntersecting;
42
+ const height = onIntersectionChange(intersectionStates, elementIndex, elements);
43
+ if (height != null) {
44
+ collapseItemIntoSpacer(index, height);
45
+ }
46
+ });
47
+ cleanups.push(cleanup);
48
+ });
49
+ return () => cleanups.forEach(_temp3);
50
+ };
51
+ t2 = [collapseItemIntoSpacer, intersectionObserverHandle, index, onIntersectionChange, refs];
52
+ $[1] = collapseItemIntoSpacer;
53
+ $[2] = index;
54
+ $[3] = intersectionObserverHandle;
55
+ $[4] = onIntersectionChange;
56
+ $[5] = refs;
57
+ $[6] = t1;
58
+ $[7] = t2;
59
+ } else {
60
+ t1 = $[6];
61
+ t2 = $[7];
62
+ }
63
+ useEffect(t1, t2);
64
+ }
65
+ function _temp3(cleanup_0) {
66
+ return cleanup_0();
67
+ }
68
+ function _temp2(r) {
69
+ return r.current;
70
+ }
71
+ function _temp() {}
72
+
73
+ export { useItemVirtualization };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Information about a column or item currently being animated after reorder.
3
+ *
4
+ * Available through {@link useReorderAnimation} to allow custom cell
5
+ * renderers to animate reordered columns and items consistently with the default
6
+ * table renderer.
7
+ */
8
+ export interface ReorderAnimation {
9
+ /**
10
+ * What is animated: columns or items (rows).
11
+ */
12
+ direction: 'columns' | 'items';
13
+ /**
14
+ * Index of the column or item being animated.
15
+ */
16
+ index: number;
17
+ /**
18
+ * Current animation phase.
19
+ */
20
+ phase: 'initial' | 'fade-out';
21
+ /**
22
+ * CSS class to apply to the animated row, cell, or another element used to
23
+ * render the animation on this phase.
24
+ *
25
+ * The class sets `background-color` and `transition`. If your custom styles
26
+ * also define `transition` on the same element, they may conflict with the
27
+ * animation.
28
+ */
29
+ className: string;
30
+ }
31
+ /**
32
+ * Provides information about the currently animated column or item after reorder.
33
+ *
34
+ * Use in a custom cell renderer to animate reordered columns and items
35
+ * consistently with the default table renderer.
36
+ */
37
+ export declare function useReorderAnimation(): ReorderAnimation | null;
@@ -0,0 +1,18 @@
1
+ import { use } from 'react';
2
+ import { ReorderAnimationContext } from '../internal/reorder-animation-context.js';
3
+ import 'react/compiler-runtime';
4
+ import '../global/parse-css-duration.js';
5
+ import '../global/schedule-with-cleanup.js';
6
+ import '../_helpers/table.js';
7
+
8
+ /**
9
+ * Provides information about the currently animated column or item after reorder.
10
+ *
11
+ * Use in a custom cell renderer to animate reordered columns and items
12
+ * consistently with the default table renderer.
13
+ */
14
+ function useReorderAnimation() {
15
+ return use(ReorderAnimationContext).reorderAnimation;
16
+ }
17
+
18
+ export { useReorderAnimation };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Registers the physical boundaries of a custom-rendered item with the reorder
3
+ * system, so that the insertion indicator and insertion point calculation are
4
+ * correct for items that span multiple rows or have non-standard sizing.
5
+ *
6
+ * `DefaultItemRenderer` calls this automatically. Use this hook in a custom item
7
+ * renderer when the default boundary measurement is insufficient — for example,
8
+ * when the item spans multiple rows, or when you don't use
9
+ * the `DefaultItemRenderer` at all.
10
+ *
11
+ * If you include `DefaultItemRenderer` inside your custom renderer, set its
12
+ * `noReorderLayout` prop to `true` to prevent double registration.
13
+ */
14
+ export declare function useReorderItemLayout({ disabled, index, getBounds, }: {
15
+ /**
16
+ * When `true`, the item is not registered. Use to disable without violating
17
+ * the rules of hooks.
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * Index of the item in the `data` array.
22
+ */
23
+ index: number;
24
+ /**
25
+ * Returns the item's top and bottom client coordinates (in pixels, relative
26
+ * to the viewport).
27
+ */
28
+ getBounds: () => {
29
+ start: number;
30
+ end: number;
31
+ };
32
+ }): void;
@@ -0,0 +1,57 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { use, useEffect } from 'react';
3
+ import { ReorderLayoutContext } from '../internal/reorder-layout-context.js';
4
+
5
+ /**
6
+ * Registers the physical boundaries of a custom-rendered item with the reorder
7
+ * system, so that the insertion indicator and insertion point calculation are
8
+ * correct for items that span multiple rows or have non-standard sizing.
9
+ *
10
+ * `DefaultItemRenderer` calls this automatically. Use this hook in a custom item
11
+ * renderer when the default boundary measurement is insufficient — for example,
12
+ * when the item spans multiple rows, or when you don't use
13
+ * the `DefaultItemRenderer` at all.
14
+ *
15
+ * If you include `DefaultItemRenderer` inside your custom renderer, set its
16
+ * `noReorderLayout` prop to `true` to prevent double registration.
17
+ */
18
+ function useReorderItemLayout(t0) {
19
+ const $ = c(7);
20
+ if ($[0] !== "f6c2f22ac6ea5d08fd2648f9af507c996aa6e89216dff089c71921e1eb0bbd40") {
21
+ for (let $i = 0; $i < 7; $i += 1) {
22
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
23
+ }
24
+ $[0] = "f6c2f22ac6ea5d08fd2648f9af507c996aa6e89216dff089c71921e1eb0bbd40";
25
+ }
26
+ const {
27
+ disabled,
28
+ index,
29
+ getBounds
30
+ } = t0;
31
+ const {
32
+ registerReorderItem
33
+ } = use(ReorderLayoutContext);
34
+ let t1;
35
+ let t2;
36
+ if ($[1] !== disabled || $[2] !== getBounds || $[3] !== index || $[4] !== registerReorderItem) {
37
+ t1 = () => {
38
+ if (disabled) {
39
+ return;
40
+ }
41
+ return registerReorderItem(index, getBounds);
42
+ };
43
+ t2 = [index, getBounds, registerReorderItem, disabled];
44
+ $[1] = disabled;
45
+ $[2] = getBounds;
46
+ $[3] = index;
47
+ $[4] = registerReorderItem;
48
+ $[5] = t1;
49
+ $[6] = t2;
50
+ } else {
51
+ t1 = $[5];
52
+ t2 = $[6];
53
+ }
54
+ useEffect(t1, t2);
55
+ }
56
+
57
+ export { useReorderItemLayout };
@@ -0,0 +1,10 @@
1
+ import type { TableProps } from './table-props';
2
+ /**
3
+ * Use anywhere inside the table to get access to the props passed to it.
4
+ * Cast to `Context<TableProps<T>>` in usage place.
5
+ */
6
+ export declare const TablePropsContext: import("react").Context<TableProps<unknown> | null>;
7
+ /**
8
+ * When a row only contains unformatted single-line text, it will be exactly of this height.
9
+ */
10
+ export declare const defaultRowHeight = 37;
@@ -0,0 +1,13 @@
1
+ import { createContext } from 'react';
2
+
3
+ /**
4
+ * Use anywhere inside the table to get access to the props passed to it.
5
+ * Cast to `Context<TableProps<T>>` in usage place.
6
+ */
7
+ const TablePropsContext = /*#__PURE__*/createContext(null);
8
+ /**
9
+ * When a row only contains unformatted single-line text, it will be exactly of this height.
10
+ */
11
+ const defaultRowHeight = 37;
12
+
13
+ export { TablePropsContext, defaultRowHeight };
@@ -0,0 +1,64 @@
1
+ import type { ComponentPropsWithRef } from 'react';
2
+ export interface TableRowProps {
3
+ /**
4
+ * @see DefaultItemRendererProps.keyboardFocusable
5
+ */
6
+ keyboardFocusable?: boolean;
7
+ }
8
+ /**
9
+ * @internal
10
+ */
11
+ export declare const keyboardFocusableAttrName = "data-keyboard-focusable";
12
+ /**
13
+ * A helper `<tr>` component for custom {@link TableProps.renderItem} implementations.
14
+ * Applies the standard row class names.
15
+ */
16
+ export declare function TableRow(props: TableRowProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element;
17
+ /**
18
+ * A helper `<td>` component for custom {@link TableProps.renderItem} implementations.
19
+ * Applies the standard cell class names, but not data-dependent `tdClassName`.
20
+ */
21
+ export declare function TableCell(props: ComponentPropsWithRef<'td'>): import("react").JSX.Element;
22
+ /**
23
+ * - `'pointerdown'` means the user has pressed the mouse button or touched the handle.
24
+ * - `number` means the distance in pixels the user has dragged the handle along
25
+ * the Y axis.
26
+ * - `'cancelled'` means the reorder was aborted — e.g. the user pressed Escape,
27
+ * released the pointer outside the browser, or dropped the item at its original
28
+ * position. Use this phase to play a cancellation animation in your custom renderer.
29
+ * This state lasts 600 ms (matching the built-in cancel animation), after which
30
+ * `undefined` is sent.
31
+ * - `undefined` means the drag interaction is fully over. Sent after a successful
32
+ * reorder as well as after the `'cancelled'` phase, so you can always do cleanup
33
+ * here without managing your own timer.
34
+ */
35
+ export type DragState = 'pointerdown' | number | 'cancelled' | undefined;
36
+ export interface ItemReorderHandleProps {
37
+ /**
38
+ * The index of the item in the table data array.
39
+ */
40
+ index: number;
41
+ /**
42
+ * When `true`, the drag frame, indicating the currently dragged item,
43
+ * will not be rendered.
44
+ */
45
+ noDragFrame?: boolean;
46
+ /**
47
+ * When `true`, the drag handle stays fixed in place instead of following
48
+ * the pointer during drag.
49
+ */
50
+ noHandleTranslate?: boolean;
51
+ /**
52
+ * Callback that is called when the user drags the handle.
53
+ * Use it for custom drag indication.
54
+ * The `TableProps.onItemReorder` will be called after this callback.
55
+ * @param state The current drag state.
56
+ */
57
+ onUserDrag?: (state: DragState) => void;
58
+ }
59
+ /**
60
+ * A drag handle that allows the user to reorder the row. Place it anywhere
61
+ * inside a row renderer.
62
+ * Use {@link TableProps.canReorderItem} and {@link TableProps.onItemReorder}.
63
+ */
64
+ export declare function ItemReorderHandle({ index, ...restProps }: ItemReorderHandleProps & ComponentPropsWithRef<'button'>): import("react").JSX.Element;
@@ -0,0 +1,180 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import classNames from 'classnames';
3
+ import { ReorderHandle } from '../internal/reorder-handle.js';
4
+ import { s as styles } from '../_helpers/table.js';
5
+ import { jsx } from 'react/jsx-runtime';
6
+ import 'react';
7
+ import '@jetbrains/icons/drag-12px';
8
+ import './table-const.js';
9
+ import '../icon/icon.js';
10
+ import 'util-deprecate';
11
+ import '../icon/icon.constants.js';
12
+ import '../_helpers/icon-svg.js';
13
+ import '../global/memoize.js';
14
+ import '../global/compose-refs.js';
15
+ import 'memoize-one';
16
+ import '../global/parse-css-duration.js';
17
+ import '../internal/reorder-animation-context.js';
18
+ import '../global/schedule-with-cleanup.js';
19
+ import '../internal/reorder-layout-context.js';
20
+
21
+ const keyboardFocusableAttrName = 'data-keyboard-focusable';
22
+ /**
23
+ * A helper `<tr>` component for custom {@link TableProps.renderItem} implementations.
24
+ * Applies the standard row class names.
25
+ */
26
+ function TableRow(props) {
27
+ const $ = c(13);
28
+ if ($[0] !== "93324b17cadcfd02a0d3ded987965c5c50fdfc14a72160047cf34b19f7c0c48d") {
29
+ for (let $i = 0; $i < 13; $i += 1) {
30
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
31
+ }
32
+ $[0] = "93324b17cadcfd02a0d3ded987965c5c50fdfc14a72160047cf34b19f7c0c48d";
33
+ }
34
+ let className;
35
+ let keyboardFocusable;
36
+ let restProps;
37
+ if ($[1] !== props) {
38
+ ({
39
+ keyboardFocusable,
40
+ className,
41
+ ...restProps
42
+ } = props);
43
+ $[1] = props;
44
+ $[2] = className;
45
+ $[3] = keyboardFocusable;
46
+ $[4] = restProps;
47
+ } else {
48
+ className = $[2];
49
+ keyboardFocusable = $[3];
50
+ restProps = $[4];
51
+ }
52
+ let t0;
53
+ if ($[5] !== className) {
54
+ t0 = classNames(styles.row, className);
55
+ $[5] = className;
56
+ $[6] = t0;
57
+ } else {
58
+ t0 = $[6];
59
+ }
60
+ const classes = t0;
61
+ let t1;
62
+ if ($[7] !== keyboardFocusable || $[8] !== restProps) {
63
+ t1 = keyboardFocusable ? {
64
+ [keyboardFocusableAttrName]: "",
65
+ ...restProps
66
+ } : restProps;
67
+ $[7] = keyboardFocusable;
68
+ $[8] = restProps;
69
+ $[9] = t1;
70
+ } else {
71
+ t1 = $[9];
72
+ }
73
+ const trRestProps = t1;
74
+ let t2;
75
+ if ($[10] !== classes || $[11] !== trRestProps) {
76
+ t2 = /*#__PURE__*/jsx("tr", {
77
+ className: classes,
78
+ ...trRestProps
79
+ });
80
+ $[10] = classes;
81
+ $[11] = trRestProps;
82
+ $[12] = t2;
83
+ } else {
84
+ t2 = $[12];
85
+ }
86
+ return t2;
87
+ }
88
+ /**
89
+ * A helper `<td>` component for custom {@link TableProps.renderItem} implementations.
90
+ * Applies the standard cell class names, but not data-dependent `tdClassName`.
91
+ */
92
+ function TableCell(props) {
93
+ const $ = c(9);
94
+ if ($[0] !== "93324b17cadcfd02a0d3ded987965c5c50fdfc14a72160047cf34b19f7c0c48d") {
95
+ for (let $i = 0; $i < 9; $i += 1) {
96
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
97
+ }
98
+ $[0] = "93324b17cadcfd02a0d3ded987965c5c50fdfc14a72160047cf34b19f7c0c48d";
99
+ }
100
+ let className;
101
+ let restProps;
102
+ if ($[1] !== props) {
103
+ ({
104
+ className,
105
+ ...restProps
106
+ } = props);
107
+ $[1] = props;
108
+ $[2] = className;
109
+ $[3] = restProps;
110
+ } else {
111
+ className = $[2];
112
+ restProps = $[3];
113
+ }
114
+ let t0;
115
+ if ($[4] !== className) {
116
+ t0 = classNames(styles.cell, className);
117
+ $[4] = className;
118
+ $[5] = t0;
119
+ } else {
120
+ t0 = $[5];
121
+ }
122
+ const classes = t0;
123
+ let t1;
124
+ if ($[6] !== classes || $[7] !== restProps) {
125
+ t1 = /*#__PURE__*/jsx("td", {
126
+ className: classes,
127
+ ...restProps
128
+ });
129
+ $[6] = classes;
130
+ $[7] = restProps;
131
+ $[8] = t1;
132
+ } else {
133
+ t1 = $[8];
134
+ }
135
+ return t1;
136
+ }
137
+ /**
138
+ * A drag handle that allows the user to reorder the row. Place it anywhere
139
+ * inside a row renderer.
140
+ * Use {@link TableProps.canReorderItem} and {@link TableProps.onItemReorder}.
141
+ */
142
+ function ItemReorderHandle(t0) {
143
+ const $ = c(7);
144
+ if ($[0] !== "93324b17cadcfd02a0d3ded987965c5c50fdfc14a72160047cf34b19f7c0c48d") {
145
+ for (let $i = 0; $i < 7; $i += 1) {
146
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
147
+ }
148
+ $[0] = "93324b17cadcfd02a0d3ded987965c5c50fdfc14a72160047cf34b19f7c0c48d";
149
+ }
150
+ let index;
151
+ let restProps;
152
+ if ($[1] !== t0) {
153
+ ({
154
+ index,
155
+ ...restProps
156
+ } = t0);
157
+ $[1] = t0;
158
+ $[2] = index;
159
+ $[3] = restProps;
160
+ } else {
161
+ index = $[2];
162
+ restProps = $[3];
163
+ }
164
+ let t1;
165
+ if ($[4] !== index || $[5] !== restProps) {
166
+ t1 = /*#__PURE__*/jsx(ReorderHandle, {
167
+ direction: "items",
168
+ index: index,
169
+ ...restProps
170
+ });
171
+ $[4] = index;
172
+ $[5] = restProps;
173
+ $[6] = t1;
174
+ } else {
175
+ t1 = $[6];
176
+ }
177
+ return t1;
178
+ }
179
+
180
+ export { ItemReorderHandle, TableCell, TableRow, keyboardFocusableAttrName };