@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
@@ -8,7 +8,7 @@ import '../global/data-tests.js';
8
8
  import '../dropdown/dropdown.js';
9
9
  import '../global/typescript-utils.js';
10
10
  import '../_helpers/anchor.js';
11
- import 'react-compiler-runtime';
11
+ import 'react/compiler-runtime';
12
12
  import '../button/button.js';
13
13
  import '@jetbrains/icons/chevron-down';
14
14
  import '@jetbrains/icons/chevron-12px-down';
@@ -7,7 +7,7 @@ import { jsx } from 'react/jsx-runtime';
7
7
  import '../global/data-tests.js';
8
8
  import '../global/typescript-utils.js';
9
9
  import '../_helpers/anchor.js';
10
- import 'react-compiler-runtime';
10
+ import 'react/compiler-runtime';
11
11
  import '../button/button.js';
12
12
  import '@jetbrains/icons/chevron-down';
13
13
  import '@jetbrains/icons/chevron-12px-down';
@@ -11,7 +11,7 @@ import '../global/url.js';
11
11
  import '../global/dom.js';
12
12
  import '../global/memoize.js';
13
13
  import '../avatar/fallback-avatar.js';
14
- import 'react-compiler-runtime';
14
+ import 'react/compiler-runtime';
15
15
  import '../global/get-uid.js';
16
16
  import '../avatar/avatar-size.js';
17
17
  import 'react/jsx-runtime';
@@ -1 +1,27 @@
1
1
  export declare const hideAddonsPanelParam = "hideAddonsPanel";
2
+ export declare function createRandom(seed: bigint): {
3
+ /**
4
+ * Fractional in [0, 1)
5
+ */
6
+ (): number;
7
+ /**
8
+ * Integer in [0, to)
9
+ */
10
+ (to: number): number;
11
+ /**
12
+ * Integer in [from, to)
13
+ */
14
+ (from: number, to: number): number;
15
+ /**
16
+ * Date in [from, to)
17
+ */
18
+ (from: Date, to: Date): Date;
19
+ /**
20
+ * Up to random n items (in random order) from the array
21
+ */
22
+ <T>(array: T[], n: number): T[];
23
+ /**
24
+ * Random item from the array
25
+ */
26
+ <T>(array: T[]): T;
27
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui-built",
3
- "version": "8.0.0-beta.2",
3
+ "version": "8.0.0-beta.4",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -97,11 +97,11 @@
97
97
  "readmeFilename": "README.md",
98
98
  "devDependencies": {},
99
99
  "peerDependencies": {
100
- "@types/react": ">=18.0.0",
101
- "@types/react-dom": ">=18.0.0",
100
+ "@types/react": ">=19.2.0",
101
+ "@types/react-dom": ">=19.2.0",
102
102
  "core-js": ">=3.0.0",
103
- "react": ">=18.0.0",
104
- "react-dom": ">=18.0.0"
103
+ "react": ">=19.2.0",
104
+ "react-dom": ">=19.2.0"
105
105
  },
106
106
  "peerDependenciesMeta": {
107
107
  "@types/react": {
@@ -112,11 +112,11 @@
112
112
  }
113
113
  },
114
114
  "dependencies": {
115
- "@jetbrains/icons": "^5.22.0",
115
+ "@jetbrains/icons": "^5.23.0",
116
116
  "change-case": "^4.1.1",
117
117
  "classnames": "^2.5.1",
118
118
  "combokeys": "^3.0.1",
119
- "date-fns": "^4.3.0",
119
+ "date-fns": "^4.4.0",
120
120
  "dequal": "^2.0.3",
121
121
  "element-resize-detector": "^1.2.4",
122
122
  "fastdom": "^1.0.12",
@@ -1,3 +0,0 @@
1
- var style = {"row":"ring-table-row","dragHandle":"ring-table-dragHandle","tableWrapper":"ring-table-tableWrapper","table":"ring-table-table","userSelectNone":"ring-table-userSelectNone","headerCell":"ring-table-headerCell ring-global-font-smaller-lower ring-global-font-smaller ring-global-font-lower ring-global-font","headerCellSorted":"ring-table-headerCellSorted","headerCellSortable":"ring-table-headerCellSortable","sorter":"ring-table-sorter","sortedUp":"ring-table-sortedUp","icon":"ring-table-icon","caption":"ring-table-caption","tableHead":"ring-table-tableHead","subHeaderSticky":"ring-table-subHeaderSticky","disabledHover":"ring-table-disabledHover","rowSelected":"ring-table-rowSelected","rowFocused":"ring-table-rowFocused","cell":"ring-table-cell ring-global-ellipsis","loadingOverlay":"ring-table-loadingOverlay","wideFirstColumn":"ring-table-wideFirstColumn","cellUnlimited":"ring-table-cellUnlimited","cellRight":"ring-table-cellRight","metaColumn":"ring-table-metaColumn","headerMetaColumn":"ring-table-headerMetaColumn","visibleDragHandle":"ring-table-visibleDragHandle","rowCollapseExpandButton":"ring-table-rowCollapseExpandButton","draggingRow":"ring-table-draggingRow","draggingTable":"ring-table-draggingTable","tableMessage":"ring-table-tableMessage"};
2
-
3
- export { style as s };
@@ -1,6 +0,0 @@
1
- import { type RefObject } from 'react';
2
- export declare function useIntersectionObserver(containerRef: RefObject<HTMLElement | null>, scrollMargin?: number): IntersectionObserverHandle | null;
3
- export interface IntersectionObserverHandle {
4
- observeVisibility(element: Element, setVisible: (isVisible: boolean) => void): () => void;
5
- }
6
- export declare function useVisibility(handle: IntersectionObserverHandle | null, elementRef: RefObject<Element | null>): boolean;
@@ -1,93 +0,0 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { useState, useEffect } from 'react';
3
-
4
- function useIntersectionObserver(containerRef, t0) {
5
- const $ = c(5);
6
- if ($[0] !== "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a") {
7
- for (let $i = 0; $i < 5; $i += 1) {
8
- $[$i] = Symbol.for("react.memo_cache_sentinel");
9
- }
10
- $[0] = "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a";
11
- }
12
- const scrollMargin = t0 === undefined ? 0 : t0;
13
- const [handle, setHandle] = useState(null);
14
- let t1;
15
- let t2;
16
- if ($[1] !== containerRef || $[2] !== scrollMargin) {
17
- t1 = () => {
18
- const container = containerRef.current;
19
- if (!container) {
20
- return;
21
- }
22
- const elementToSetVisible = new Map();
23
- const observer = new IntersectionObserver(entries => {
24
- for (const entry of entries) {
25
- const setVisible = elementToSetVisible.get(entry.target);
26
- setVisible?.(entry.isIntersecting);
27
- }
28
- }, {
29
- root: container,
30
- ...(scrollMargin ? {
31
- scrollMargin: `${scrollMargin}px`
32
- } : {})
33
- });
34
- setHandle({
35
- observeVisibility(element, setVisible_0) {
36
- elementToSetVisible.set(element, setVisible_0);
37
- observer.observe(element);
38
- return () => {
39
- elementToSetVisible.delete(element);
40
- observer.unobserve(element);
41
- };
42
- }
43
- });
44
- return () => {
45
- observer.disconnect();
46
- setHandle(null);
47
- };
48
- };
49
- t2 = [containerRef, scrollMargin];
50
- $[1] = containerRef;
51
- $[2] = scrollMargin;
52
- $[3] = t1;
53
- $[4] = t2;
54
- } else {
55
- t1 = $[3];
56
- t2 = $[4];
57
- }
58
- useEffect(t1, t2);
59
- return handle;
60
- }
61
- function useVisibility(handle, elementRef) {
62
- const $ = c(5);
63
- if ($[0] !== "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a") {
64
- for (let $i = 0; $i < 5; $i += 1) {
65
- $[$i] = Symbol.for("react.memo_cache_sentinel");
66
- }
67
- $[0] = "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a";
68
- }
69
- const [isVisible, setIsVisible] = useState(false);
70
- let t0;
71
- let t1;
72
- if ($[1] !== elementRef || $[2] !== handle) {
73
- t0 = () => {
74
- const element = elementRef.current;
75
- if (!element || !handle) {
76
- return;
77
- }
78
- return handle.observeVisibility(element, setIsVisible);
79
- };
80
- t1 = [handle, elementRef, setIsVisible];
81
- $[1] = elementRef;
82
- $[2] = handle;
83
- $[3] = t0;
84
- $[4] = t1;
85
- } else {
86
- t0 = $[3];
87
- t1 = $[4];
88
- }
89
- useEffect(t0, t1);
90
- return isVisible;
91
- }
92
-
93
- export { useIntersectionObserver, useVisibility };
@@ -1,6 +0,0 @@
1
- import { createComposedRef as _createComposedRef } from './compose-refs';
2
- /**
3
- * @deprecated Use createComposedRef from './compose-refs' instead
4
- */
5
- declare const createComposedRef: typeof _createComposedRef;
6
- export { createComposedRef };
@@ -1,9 +0,0 @@
1
- import { createComposedRef as createComposedRef$1 } from './compose-refs.js';
2
- import 'memoize-one';
3
-
4
- /**
5
- * @deprecated Use createComposedRef from './compose-refs' instead
6
- */
7
- const createComposedRef = createComposedRef$1;
8
-
9
- export { createComposedRef };
@@ -1 +0,0 @@
1
- export default function useEventCallback<I extends unknown[], O>(fn: (...args: I) => O): (...args: I) => O;
@@ -1,44 +0,0 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { useRef, useLayoutEffect } from 'react';
3
-
4
- // TODO deprecate in favor of useEffectEvent after dropping support for React < 19.2
5
- function useEventCallback(fn) {
6
- const $ = c(4);
7
- if ($[0] !== "889dd896626d55d7ee8b6d837575138afdbc32f6790b79c2a3b63812dc174b4f") {
8
- for (let $i = 0; $i < 4; $i += 1) {
9
- $[$i] = Symbol.for("react.memo_cache_sentinel");
10
- }
11
- $[0] = "889dd896626d55d7ee8b6d837575138afdbc32f6790b79c2a3b63812dc174b4f";
12
- }
13
- const ref = useRef(null);
14
- let t0;
15
- if ($[1] !== fn) {
16
- t0 = () => {
17
- ref.current = fn;
18
- };
19
- $[1] = fn;
20
- $[2] = t0;
21
- } else {
22
- t0 = $[2];
23
- }
24
- useLayoutEffect(t0);
25
- let t1;
26
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
27
- t1 = (...t2) => {
28
- const args = t2;
29
- const {
30
- current
31
- } = ref;
32
- if (current === null || current === undefined) {
33
- throw new Error("callback created in useEventCallback can only be called from event handlers");
34
- }
35
- return current(...args);
36
- };
37
- $[3] = t1;
38
- } else {
39
- t1 = $[3];
40
- }
41
- return t1;
42
- }
43
-
44
- export { useEventCallback as default };
@@ -1,24 +0,0 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- /**
3
- * Include it in a column header to make the column sortable.
4
- * Handle clicks with {@link TableProps.onSort}.
5
- */
6
- export declare function SortButton<T>(props: ComponentPropsWithoutRef<'button'>): import("react").JSX.Element | null;
7
- /**
8
- * Include it in a column header to make the column deletable.
9
- * Beware that `column.name ?? String(column.key)` is used in the aria-label.
10
- * Handle clicks with {@link TableProps.onColumnDelete}.
11
- */
12
- export declare function DeleteColumnButton<T>(props: ComponentPropsWithoutRef<'button'>): import("react").JSX.Element | null;
13
- /**
14
- * A helper `<tr>` component for a custom {@link TableProps.renderItem} implementations.
15
- * Applies the standard row classnames.
16
- */
17
- export declare function TableRow(props: {
18
- ref?: React.Ref<HTMLTableRowElement>;
19
- } & ComponentPropsWithoutRef<'tr'>): import("react").JSX.Element;
20
- /**
21
- * A helper `<td>` component for a custom {@link TableProps.renderItem} implementations.
22
- * Applies the standard cell classnames, but not data-dependent `tdClassName`.
23
- */
24
- export declare function TableCell(props: ComponentPropsWithoutRef<'td'>): import("react").JSX.Element;
@@ -1,311 +0,0 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { useContext } from 'react';
3
- import classNames from 'classnames';
4
- import unsortedIcon from '@jetbrains/icons/unsorted-12px';
5
- import arrowDownIcon from '@jetbrains/icons/arrow-12px-down';
6
- import arrowUpIcon from '@jetbrains/icons/arrow-12px-up';
7
- import trashIcon from '@jetbrains/icons/trash-12px';
8
- import Icon from '../icon/icon.js';
9
- import { TablePropsContext, ColumnIndexContext } from './table-const.js';
10
- import { s as styles } from '../_helpers/table.js';
11
- import { jsx, jsxs } from 'react/jsx-runtime';
12
- import 'util-deprecate';
13
- import '../icon/icon.constants.js';
14
- import '../_helpers/icon-svg.js';
15
- import '../global/memoize.js';
16
-
17
- function SortButton(props) {
18
- var _column$sortOrder;
19
- const $ = c(21);
20
- if ($[0] !== "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369") {
21
- for (let $i = 0; $i < 21; $i += 1) {
22
- $[$i] = Symbol.for("react.memo_cache_sentinel");
23
- }
24
- $[0] = "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369";
25
- }
26
- const tableProps = useContext(TablePropsContext);
27
- const columnIndex = useContext(ColumnIndexContext);
28
- const column = tableProps?.columns[columnIndex];
29
- if (!tableProps || !column) {
30
- return null;
31
- }
32
- const sortOrder = (_column$sortOrder = column.sortOrder) !== null && _column$sortOrder !== void 0 ? _column$sortOrder : "none";
33
- const glyph = sortOrder === "none" ? unsortedIcon : sortOrder === "ascending" ? arrowUpIcon : arrowDownIcon;
34
- let children;
35
- let className;
36
- let onClick;
37
- let restProps;
38
- if ($[1] !== props) {
39
- ({
40
- className,
41
- children,
42
- onClick,
43
- ...restProps
44
- } = props);
45
- $[1] = props;
46
- $[2] = children;
47
- $[3] = className;
48
- $[4] = onClick;
49
- $[5] = restProps;
50
- } else {
51
- children = $[2];
52
- className = $[3];
53
- onClick = $[4];
54
- restProps = $[5];
55
- }
56
- let t0;
57
- if ($[6] !== columnIndex || $[7] !== onClick || $[8] !== sortOrder || $[9] !== tableProps) {
58
- t0 = function handleClick(e) {
59
- onClick?.(e);
60
- if (!e.defaultPrevented) {
61
- const sequence = ["none", "ascending", "descending"];
62
- const nextOrder = sequence[(sequence.indexOf(sortOrder) + 1) % sequence.length];
63
- tableProps.onSort?.(columnIndex, nextOrder);
64
- }
65
- };
66
- $[6] = columnIndex;
67
- $[7] = onClick;
68
- $[8] = sortOrder;
69
- $[9] = tableProps;
70
- $[10] = t0;
71
- } else {
72
- t0 = $[10];
73
- }
74
- const handleClick = t0;
75
- let t1;
76
- if ($[11] !== className) {
77
- t1 = classNames(styles.headerButton, className);
78
- $[11] = className;
79
- $[12] = t1;
80
- } else {
81
- t1 = $[12];
82
- }
83
- let t2;
84
- if ($[13] !== glyph) {
85
- t2 = /*#__PURE__*/jsx(Icon, {
86
- glyph: glyph,
87
- "aria-hidden": true
88
- });
89
- $[13] = glyph;
90
- $[14] = t2;
91
- } else {
92
- t2 = $[14];
93
- }
94
- let t3;
95
- if ($[15] !== children || $[16] !== handleClick || $[17] !== restProps || $[18] !== t1 || $[19] !== t2) {
96
- t3 = /*#__PURE__*/jsxs("button", {
97
- type: "button",
98
- className: t1,
99
- onClick: handleClick,
100
- ...restProps,
101
- children: [children, " ", t2]
102
- });
103
- $[15] = children;
104
- $[16] = handleClick;
105
- $[17] = restProps;
106
- $[18] = t1;
107
- $[19] = t2;
108
- $[20] = t3;
109
- } else {
110
- t3 = $[20];
111
- }
112
- return t3;
113
- }
114
- /**
115
- * Include it in a column header to make the column deletable.
116
- * Beware that `column.name ?? String(column.key)` is used in the aria-label.
117
- * Handle clicks with {@link TableProps.onColumnDelete}.
118
- */
119
- function DeleteColumnButton(props) {
120
- var _column$name;
121
- const $ = c(17);
122
- if ($[0] !== "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369") {
123
- for (let $i = 0; $i < 17; $i += 1) {
124
- $[$i] = Symbol.for("react.memo_cache_sentinel");
125
- }
126
- $[0] = "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369";
127
- }
128
- const tableProps = useContext(TablePropsContext);
129
- const columnIndex = useContext(ColumnIndexContext);
130
- const column = tableProps?.columns[columnIndex];
131
- if (!tableProps || !column) {
132
- return null;
133
- }
134
- let className;
135
- let onClick;
136
- let restProps;
137
- if ($[1] !== props) {
138
- ({
139
- className,
140
- onClick,
141
- ...restProps
142
- } = props);
143
- $[1] = props;
144
- $[2] = className;
145
- $[3] = onClick;
146
- $[4] = restProps;
147
- } else {
148
- className = $[2];
149
- onClick = $[3];
150
- restProps = $[4];
151
- }
152
- let t0;
153
- if ($[5] !== columnIndex || $[6] !== onClick || $[7] !== tableProps) {
154
- t0 = function handleClick(e) {
155
- onClick?.(e);
156
- if (!e.defaultPrevented) {
157
- tableProps.onColumnDelete?.(columnIndex);
158
- }
159
- };
160
- $[5] = columnIndex;
161
- $[6] = onClick;
162
- $[7] = tableProps;
163
- $[8] = t0;
164
- } else {
165
- t0 = $[8];
166
- }
167
- const handleClick = t0;
168
- let t1;
169
- if ($[9] !== className) {
170
- t1 = classNames(styles.headerButton, styles.deleteColumnButton, className);
171
- $[9] = className;
172
- $[10] = t1;
173
- } else {
174
- t1 = $[10];
175
- }
176
- const t2 = `Delete column ${(_column$name = column.name) !== null && _column$name !== void 0 ? _column$name : String(column.key)}`;
177
- let t3;
178
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
179
- t3 = /*#__PURE__*/jsx(Icon, {
180
- glyph: trashIcon
181
- });
182
- $[11] = t3;
183
- } else {
184
- t3 = $[11];
185
- }
186
- let t4;
187
- if ($[12] !== handleClick || $[13] !== restProps || $[14] !== t1 || $[15] !== t2) {
188
- t4 = /*#__PURE__*/jsx("button", {
189
- type: "button",
190
- className: t1,
191
- onClick: handleClick,
192
- "aria-label": t2,
193
- ...restProps,
194
- children: t3
195
- });
196
- $[12] = handleClick;
197
- $[13] = restProps;
198
- $[14] = t1;
199
- $[15] = t2;
200
- $[16] = t4;
201
- } else {
202
- t4 = $[16];
203
- }
204
- return t4;
205
- }
206
- /**
207
- * A helper `<tr>` component for a custom {@link TableProps.renderItem} implementations.
208
- * Applies the standard row classnames.
209
- */
210
- function TableRow(props) {
211
- const $ = c(11);
212
- if ($[0] !== "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369") {
213
- for (let $i = 0; $i < 11; $i += 1) {
214
- $[$i] = Symbol.for("react.memo_cache_sentinel");
215
- }
216
- $[0] = "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369";
217
- }
218
- let className;
219
- let ref;
220
- let restProps;
221
- if ($[1] !== props) {
222
- ({
223
- ref,
224
- className,
225
- ...restProps
226
- } = props);
227
- $[1] = props;
228
- $[2] = className;
229
- $[3] = ref;
230
- $[4] = restProps;
231
- } else {
232
- className = $[2];
233
- ref = $[3];
234
- restProps = $[4];
235
- }
236
- let t0;
237
- if ($[5] !== className) {
238
- t0 = classNames(styles.row, className);
239
- $[5] = className;
240
- $[6] = t0;
241
- } else {
242
- t0 = $[6];
243
- }
244
- const classes = t0;
245
- let t1;
246
- if ($[7] !== classes || $[8] !== ref || $[9] !== restProps) {
247
- t1 = /*#__PURE__*/jsx("tr", {
248
- ref: ref,
249
- className: classes,
250
- ...restProps
251
- });
252
- $[7] = classes;
253
- $[8] = ref;
254
- $[9] = restProps;
255
- $[10] = t1;
256
- } else {
257
- t1 = $[10];
258
- }
259
- return t1;
260
- }
261
- /**
262
- * A helper `<td>` component for a custom {@link TableProps.renderItem} implementations.
263
- * Applies the standard cell classnames, but not data-dependent `tdClassName`.
264
- */
265
- function TableCell(props) {
266
- const $ = c(9);
267
- if ($[0] !== "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369") {
268
- for (let $i = 0; $i < 9; $i += 1) {
269
- $[$i] = Symbol.for("react.memo_cache_sentinel");
270
- }
271
- $[0] = "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369";
272
- }
273
- let className;
274
- let restProps;
275
- if ($[1] !== props) {
276
- ({
277
- className,
278
- ...restProps
279
- } = props);
280
- $[1] = props;
281
- $[2] = className;
282
- $[3] = restProps;
283
- } else {
284
- className = $[2];
285
- restProps = $[3];
286
- }
287
- let t0;
288
- if ($[4] !== className) {
289
- t0 = classNames(styles.cell, className);
290
- $[4] = className;
291
- $[5] = t0;
292
- } else {
293
- t0 = $[5];
294
- }
295
- const classes = t0;
296
- let t1;
297
- if ($[6] !== classes || $[7] !== restProps) {
298
- t1 = /*#__PURE__*/jsx("td", {
299
- className: classes,
300
- ...restProps
301
- });
302
- $[6] = classes;
303
- $[7] = restProps;
304
- $[8] = t1;
305
- } else {
306
- t1 = $[8];
307
- }
308
- return t1;
309
- }
310
-
311
- export { DeleteColumnButton, SortButton, TableCell, TableRow };
@@ -1,53 +0,0 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- import type { TableProps } from './table';
3
- /**
4
- * The new Table component. Use it instead of tables in the `legacy-table` folder.
5
- *
6
- * Minimal usage requires the following props:
7
- * - `data`
8
- * - `getKey`
9
- * - `columns`
10
- * - `key`
11
- * - `renderCell` (not required, but usually needed)
12
- *
13
- * ## Selection
14
- *
15
- * Following three props support the selection:
16
- *
17
- * - `selection`
18
- * - `isItemClickable`
19
- * - `DefaultItemRenderer.onClick`
20
- *
21
- * Only `selection` is required: you can display and modify selection your way, e.g., via
22
- * checkboxes in cells.
23
- *
24
- * ## Sorting
25
- * You need the following to support sorting:
26
- *
27
- * - Include `<SortButton />` in a column header
28
- * - Set initial `Column.sortOrder` to `none`, `ascending`.
29
- * Do not leave `undefined` for the accessibility reasons.
30
- * - Handle `TableProps.onSort` callback in the client code. It is expected
31
- * to update `columns`, by setting the new `sortOrder` value for
32
- * the corresponding column, and updating the data accordingly.
33
- *
34
- * ## Deleting columns
35
- * You need the following to support deleting columns:
36
- *
37
- * - Make sure the `column` has a proper `name` or `key` prop, which will be
38
- * automatically included in the aria-label of `<DeleteColumnButton />`.
39
- * - Include `<DeleteColumnButton />` in a column header
40
- * - Handle `TableProps.onColumnDelete` callback in the client code. It is expected
41
- * to update `columns` by removing the corresponding column.
42
- *
43
- * ## Row virtualization
44
- *
45
- * To render only rows near the viewport and replace others with spacers, use:
46
- *
47
- * - `virtualizeRows`
48
- * - `scrollerRef` — required when the scrollable container is not the whole document
49
- * - `estimateHeight` — recommended when rows are expected to be taller than
50
- * the default height (e.g. multiline or custom content)
51
- * - Fine-tuning props: `lookaheadPx`, `retentionMarginPx`, `minScrollAndResizeDeltaPx`
52
- */
53
- export default function Table<T>(props: TableProps<T> & ComponentPropsWithoutRef<'table'>): import("react").JSX.Element;