@jetbrains/ring-ui-built 7.0.115 → 8.0.0-beta.3

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 (189) hide show
  1. package/components/_helpers/anchor.js +1 -1
  2. package/components/_helpers/avatar-info.js +1 -1
  3. package/components/_helpers/icon-svg.js +1 -1
  4. package/components/_helpers/legacy-table.js +3 -0
  5. package/components/_helpers/tab-link.js +1 -1
  6. package/components/_helpers/table.js +2 -2
  7. package/components/_helpers/theme.js +49 -37
  8. package/components/alert/alert.js +1 -1
  9. package/components/alert-service/alert-service.js +1 -1
  10. package/components/auth/auth-core.js +1 -1
  11. package/components/auth/auth.js +1 -1
  12. package/components/auth/down-notification.js +1 -1
  13. package/components/auth/iframe-flow.js +1 -1
  14. package/components/auth/storage.js +1 -1
  15. package/components/auth-dialog/auth-dialog.js +1 -1
  16. package/components/auth-dialog-service/auth-dialog-service.js +2 -2
  17. package/components/avatar/avatar-info.js +1 -1
  18. package/components/avatar/avatar.js +1 -1
  19. package/components/avatar/fallback-avatar.js +1 -1
  20. package/components/avatar-stack/avatar-stack.js +1 -1
  21. package/components/banner/banner.js +1 -1
  22. package/components/button/button.js +1 -1
  23. package/components/button-group/button-group.js +1 -1
  24. package/components/checkbox/checkbox.js +1 -1
  25. package/components/clipboard/clipboard.js +1 -1
  26. package/components/collapse/collapse-content.js +5 -5
  27. package/components/collapse/collapse-control.js +5 -5
  28. package/components/collapse/collapse.js +4 -4
  29. package/components/confirm/confirm.js +1 -1
  30. package/components/confirm-service/confirm-service.js +2 -2
  31. package/components/contenteditable/contenteditable.js +1 -1
  32. package/components/control-help/control-help.js +1 -1
  33. package/components/control-label/control-label.js +1 -1
  34. package/components/data-list/data-list.d.ts +4 -4
  35. package/components/data-list/data-list.js +3 -3
  36. package/components/data-list/data-list.mock.d.ts +1 -1
  37. package/components/data-list/data-list.mock.js +1 -1
  38. package/components/data-list/item.d.ts +1 -1
  39. package/components/data-list/item.js +1 -1
  40. package/components/data-list/selection.d.ts +1 -1
  41. package/components/data-list/selection.js +2 -2
  42. package/components/data-list/title.js +1 -1
  43. package/components/date-picker/date-input.js +1 -1
  44. package/components/date-picker/date-picker.js +2 -3
  45. package/components/date-picker/date-popup.js +2 -3
  46. package/components/date-picker/month-names.js +1 -1
  47. package/components/date-picker/month-slider.js +1 -1
  48. package/components/date-picker/month.d.ts +0 -2
  49. package/components/date-picker/month.js +17 -18
  50. package/components/date-picker/months.js +43 -35
  51. package/components/date-picker/use-intersection-observer.js +1 -1
  52. package/components/date-picker/use-scroll-behavior.js +45 -44
  53. package/components/date-picker/weekdays.js +1 -1
  54. package/components/date-picker/years.js +61 -54
  55. package/components/dialog/dialog.d.ts +2 -2
  56. package/components/dialog/dialog.js +3 -3
  57. package/components/dropdown/anchor.js +1 -1
  58. package/components/dropdown/dropdown.js +1 -1
  59. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  60. package/components/dropdown-menu/dropdown-menu.js +62 -57
  61. package/components/editable-heading/editable-heading.d.ts +1 -2
  62. package/components/editable-heading/editable-heading.js +13 -12
  63. package/components/error-bubble/error-bubble.js +1 -1
  64. package/components/error-message/error-message.js +1 -1
  65. package/components/expand/collapsible-group.d.ts +5 -1
  66. package/components/expand/collapsible-group.js +15 -14
  67. package/components/footer/footer.js +1 -1
  68. package/components/global/create-stateful-context.js +11 -11
  69. package/components/global/intersection-observer-context.d.ts +26 -0
  70. package/components/global/intersection-observer-context.js +140 -0
  71. package/components/global/rerender-hoc.d.ts +4 -2
  72. package/components/global/rerender-hoc.js +10 -24
  73. package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
  74. package/components/{table/selection.js → global/table-selection.js} +4 -4
  75. package/components/global/theme.d.ts +4 -3
  76. package/components/global/theme.js +1 -1
  77. package/components/header/header-icon.js +1 -1
  78. package/components/header/header.js +1 -1
  79. package/components/header/links.js +1 -1
  80. package/components/header/logo.js +1 -1
  81. package/components/header/profile.js +1 -1
  82. package/components/header/services.js +1 -1
  83. package/components/header/smart-profile.js +1 -1
  84. package/components/header/smart-services.js +1 -1
  85. package/components/heading/heading.js +1 -1
  86. package/components/i18n/i18n-context.js +4 -4
  87. package/components/icon/icon-svg.js +1 -1
  88. package/components/icon/icon.js +1 -1
  89. package/components/icon/index.js +1 -1
  90. package/components/input/input.js +1 -1
  91. package/components/island/adaptive-island-hoc.js +3 -3
  92. package/components/island/content.d.ts +7 -2
  93. package/components/island/content.js +27 -18
  94. package/components/island/header.js +1 -1
  95. package/components/island/island.js +1 -1
  96. package/components/{table → legacy-table}/cell.js +1 -1
  97. package/components/{table → legacy-table}/header-cell.js +4 -4
  98. package/components/{table → legacy-table}/header.js +2 -2
  99. package/components/{table → legacy-table}/multitable.d.ts +1 -1
  100. package/components/{table → legacy-table}/row-with-focus-sensor.js +2 -2
  101. package/components/{table → legacy-table}/row.js +4 -4
  102. package/components/legacy-table/selection-adapter.d.ts +6 -0
  103. package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
  104. package/components/{table → legacy-table}/simple-table.d.ts +2 -2
  105. package/components/{table → legacy-table}/simple-table.js +4 -4
  106. package/components/{table → legacy-table}/smart-table.d.ts +5 -5
  107. package/components/{table → legacy-table}/smart-table.js +5 -5
  108. package/components/legacy-table/table.d.ts +109 -0
  109. package/components/legacy-table/table.js +369 -0
  110. package/components/list/list-item.js +1 -1
  111. package/components/list/list-users-groups-source.js +1 -1
  112. package/components/list/list.js +1 -1
  113. package/components/login-dialog/login-dialog.js +1 -1
  114. package/components/login-dialog/service.js +2 -2
  115. package/components/message/message.js +1 -1
  116. package/components/old-browsers-message/white-list.js +2 -2
  117. package/components/pager/pager.js +1 -1
  118. package/components/popup/popup.js +1 -1
  119. package/components/popup/popup.target.d.ts +3 -2
  120. package/components/popup/popup.target.js +32 -28
  121. package/components/popup-menu/popup-menu.js +1 -1
  122. package/components/query-assist/query-assist-suggestions.js +1 -1
  123. package/components/query-assist/query-assist.d.ts +3 -1
  124. package/components/query-assist/query-assist.js +2 -2
  125. package/components/radio/radio-item.d.ts +3 -3
  126. package/components/radio/radio-item.js +32 -18
  127. package/components/radio/radio.d.ts +2 -2
  128. package/components/radio/radio.js +2 -2
  129. package/components/scrollable-section/scrollable-section.js +1 -1
  130. package/components/select/chevron-button.js +1 -1
  131. package/components/select/select-filter.js +1 -1
  132. package/components/select/select-popup.js +1 -1
  133. package/components/select/select.d.ts +3 -1
  134. package/components/select/select.js +1 -1
  135. package/components/slider/slider.js +100 -96
  136. package/components/storage/storage-local.js +1 -1
  137. package/components/storage/storage.js +1 -1
  138. package/components/style.css +1 -1
  139. package/components/tab-trap/tab-trap.d.ts +3 -3
  140. package/components/tab-trap/tab-trap.js +83 -80
  141. package/components/table/default-item-renderer.d.ts +36 -0
  142. package/components/table/default-item-renderer.js +182 -0
  143. package/components/table/table-component.d.ts +80 -0
  144. package/components/table/table-component.js +290 -0
  145. package/components/table/table-const.d.ts +8 -0
  146. package/components/table/table-const.js +11 -0
  147. package/components/table/table-primitives.d.ts +28 -0
  148. package/components/table/table-primitives.js +323 -0
  149. package/components/table/table-row-focus.d.ts +4 -0
  150. package/components/table/table-row-focus.js +41 -0
  151. package/components/table/table-virtualize.d.ts +32 -0
  152. package/components/table/table-virtualize.js +329 -0
  153. package/components/table/table.d.ts +206 -104
  154. package/components/table/table.js +19 -362
  155. package/components/tabs/collapsible-more.js +1 -1
  156. package/components/tabs/collapsible-tab.js +1 -1
  157. package/components/tabs/collapsible-tabs.js +1 -1
  158. package/components/tabs/dumb-tabs.js +1 -1
  159. package/components/tabs/smart-tabs.js +1 -1
  160. package/components/tabs/tab-link.js +1 -1
  161. package/components/tabs/tabs.js +1 -1
  162. package/components/tag/tag.js +1 -1
  163. package/components/tags-input/tags-input.d.ts +3 -1
  164. package/components/tags-input/tags-input.js +1 -1
  165. package/components/tags-list/tags-list.js +1 -1
  166. package/components/toggle/toggle.js +1 -1
  167. package/components/tooltip/tooltip.js +2 -2
  168. package/components/upload/upload.d.ts +4 -3
  169. package/components/upload/upload.js +7 -29
  170. package/components/user-agreement/service.js +2 -2
  171. package/components/user-agreement/user-agreement.js +1 -1
  172. package/components/user-card/card.js +1 -1
  173. package/components/user-card/smart-user-card-tooltip.js +1 -1
  174. package/components/user-card/tooltip.js +1 -1
  175. package/components/user-card/user-card.js +1 -1
  176. package/package.json +6 -6
  177. package/components/global/use-event-callback.d.ts +0 -1
  178. package/components/global/use-event-callback.js +0 -44
  179. package/components/table/selection-adapter.d.ts +0 -6
  180. /package/components/{table → legacy-table}/cell.d.ts +0 -0
  181. /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
  182. /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
  183. /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
  184. /package/components/{table → legacy-table}/header.d.ts +0 -0
  185. /package/components/{table → legacy-table}/multitable.js +0 -0
  186. /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
  187. /package/components/{table → legacy-table}/row.d.ts +0 -0
  188. /package/components/{table → legacy-table}/selection-adapter.js +0 -0
  189. /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
@@ -2,6 +2,7 @@ import { type HTMLAttributes, type ReactNode } from 'react';
2
2
  import * as React from 'react';
3
3
  export declare const FOCUSABLE_ELEMENTS = "input, button, select, textarea, a[href], *[tabindex]:not([data-trap-button]):not([data-scrollable-container])";
4
4
  export interface TabTrapProps extends HTMLAttributes<HTMLElement> {
5
+ ref?: React.Ref<TabTrapObject>;
5
6
  children: ReactNode;
6
7
  trapDisabled?: boolean;
7
8
  autoFocusFirst?: boolean;
@@ -11,8 +12,7 @@ export interface TabTrapProps extends HTMLAttributes<HTMLElement> {
11
12
  /**
12
13
  * @name TabTrap
13
14
  */
14
- interface TabTrap {
15
+ export interface TabTrapObject {
15
16
  node: HTMLElement | null;
16
17
  }
17
- declare const TabTrap: React.ForwardRefExoticComponent<TabTrapProps & React.RefAttributes<TabTrap>>;
18
- export default TabTrap;
18
+ export default function TabTrap({ ref, children, trapDisabled, autoFocusFirst, focusBackOnClose, focusBackOnExit, ...restProps }: TabTrapProps): React.JSX.Element;
@@ -1,21 +1,21 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { forwardRef, useRef, useImperativeHandle, useEffect } from 'react';
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useRef, useImperativeHandle, useEffect } from 'react';
3
3
  import { isNodeInVisiblePartOfPage } from '../global/dom.js';
4
4
  import { jsx, jsxs } from 'react/jsx-runtime';
5
5
 
6
6
  var styles = {"trapButton":"ring-tab-trap-trapButton"};
7
7
 
8
8
  const FOCUSABLE_ELEMENTS = 'input, button, select, textarea, a[href], *[tabindex]:not([data-trap-button]):not([data-scrollable-container])';
9
- // eslint-disable-next-line no-shadow
10
- const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
11
- const $ = c(38);
12
- if ($[0] !== "2100b1464fbf6825dd3f080feb9e20c095c3f9f9256eec8ae18adf474c19d1f2") {
13
- for (let $i = 0; $i < 38; $i += 1) {
9
+ function TabTrap(t0) {
10
+ const $ = c(39);
11
+ if ($[0] !== "daf3c9f73144edaae4842be22241426b0a063f37615637c8bca095939d2fdeaf") {
12
+ for (let $i = 0; $i < 39; $i += 1) {
14
13
  $[$i] = Symbol.for("react.memo_cache_sentinel");
15
14
  }
16
- $[0] = "2100b1464fbf6825dd3f080feb9e20c095c3f9f9256eec8ae18adf474c19d1f2";
15
+ $[0] = "daf3c9f73144edaae4842be22241426b0a063f37615637c8bca095939d2fdeaf";
17
16
  }
18
17
  let children;
18
+ let ref;
19
19
  let restProps;
20
20
  let t1;
21
21
  let t2;
@@ -23,6 +23,7 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
23
23
  let t4;
24
24
  if ($[1] !== t0) {
25
25
  ({
26
+ ref,
26
27
  children,
27
28
  trapDisabled: t1,
28
29
  autoFocusFirst: t2,
@@ -32,18 +33,20 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
32
33
  } = t0);
33
34
  $[1] = t0;
34
35
  $[2] = children;
35
- $[3] = restProps;
36
- $[4] = t1;
37
- $[5] = t2;
38
- $[6] = t3;
39
- $[7] = t4;
36
+ $[3] = ref;
37
+ $[4] = restProps;
38
+ $[5] = t1;
39
+ $[6] = t2;
40
+ $[7] = t3;
41
+ $[8] = t4;
40
42
  } else {
41
43
  children = $[2];
42
- restProps = $[3];
43
- t1 = $[4];
44
- t2 = $[5];
45
- t3 = $[6];
46
- t4 = $[7];
44
+ ref = $[3];
45
+ restProps = $[4];
46
+ t1 = $[5];
47
+ t2 = $[6];
48
+ t3 = $[7];
49
+ t4 = $[8];
47
50
  }
48
51
  const trapDisabled = t1 === undefined ? false : t1;
49
52
  const autoFocusFirst = t2 === undefined ? true : t2;
@@ -59,20 +62,20 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
59
62
  }
60
63
  let t5;
61
64
  let t6;
62
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
65
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
63
66
  t5 = () => ({
64
67
  node: nodeRef.current
65
68
  });
66
69
  t6 = [];
67
- $[8] = t5;
68
- $[9] = t6;
70
+ $[9] = t5;
71
+ $[10] = t6;
69
72
  } else {
70
- t5 = $[8];
71
- t6 = $[9];
73
+ t5 = $[9];
74
+ t6 = $[10];
72
75
  }
73
76
  useImperativeHandle(ref, t5, t6);
74
77
  let t7;
75
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
78
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
76
79
  t7 = function restoreFocusIfUnmounted(orElse) {
77
80
  const previousFocusedNode = previousFocusedNodeRef.current;
78
81
  if (previousFocusedNode instanceof HTMLElement && previousFocusedNode.focus && isNodeInVisiblePartOfPage(previousFocusedNode) && mountedRef.current === false) {
@@ -83,13 +86,13 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
83
86
  orElse?.();
84
87
  }
85
88
  };
86
- $[10] = t7;
89
+ $[11] = t7;
87
90
  } else {
88
- t7 = $[10];
91
+ t7 = $[11];
89
92
  }
90
93
  const restoreFocusIfUnmounted = t7;
91
94
  let t8;
92
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
95
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
93
96
  t8 = function focusElement(t9) {
94
97
  const first = t9 === undefined ? true : t9;
95
98
  const node = nodeRef.current;
@@ -102,30 +105,30 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
102
105
  toBeFocused.focus();
103
106
  }
104
107
  };
105
- $[11] = t8;
108
+ $[12] = t8;
106
109
  } else {
107
- t8 = $[11];
110
+ t8 = $[12];
108
111
  }
109
112
  const focusElement = t8;
110
113
  let t9;
111
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
114
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
112
115
  t9 = () => focusElement(true);
113
- $[12] = t9;
116
+ $[13] = t9;
114
117
  } else {
115
- t9 = $[12];
118
+ t9 = $[13];
116
119
  }
117
120
  const focusFirst = t9;
118
121
  let t10;
119
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
122
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
120
123
  t10 = () => focusElement(false);
121
- $[13] = t10;
124
+ $[14] = t10;
122
125
  } else {
123
- t10 = $[13];
126
+ t10 = $[14];
124
127
  }
125
128
  const focusLast = t10;
126
129
  let t11;
127
130
  let t12;
128
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
131
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
129
132
  t11 = () => {
130
133
  mountedRef.current = true;
131
134
  return () => {
@@ -133,16 +136,16 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
133
136
  };
134
137
  };
135
138
  t12 = [];
136
- $[14] = t11;
137
- $[15] = t12;
139
+ $[15] = t11;
140
+ $[16] = t12;
138
141
  } else {
139
- t11 = $[14];
140
- t12 = $[15];
142
+ t11 = $[15];
143
+ t12 = $[16];
141
144
  }
142
145
  useEffect(t11, t12);
143
146
  let t13;
144
147
  let t14;
145
- if ($[16] !== autoFocusFirst || $[17] !== focusBackOnClose || $[18] !== trapDisabled) {
148
+ if ($[17] !== autoFocusFirst || $[18] !== focusBackOnClose || $[19] !== trapDisabled) {
146
149
  t13 = () => {
147
150
  if (autoFocusFirst) {
148
151
  focusFirst();
@@ -163,18 +166,18 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
163
166
  };
164
167
  };
165
168
  t14 = [autoFocusFirst, trapDisabled, focusBackOnClose, focusFirst];
166
- $[16] = autoFocusFirst;
167
- $[17] = focusBackOnClose;
168
- $[18] = trapDisabled;
169
- $[19] = t13;
170
- $[20] = t14;
169
+ $[17] = autoFocusFirst;
170
+ $[18] = focusBackOnClose;
171
+ $[19] = trapDisabled;
172
+ $[20] = t13;
173
+ $[21] = t14;
171
174
  } else {
172
- t13 = $[19];
173
- t14 = $[20];
175
+ t13 = $[20];
176
+ t14 = $[21];
174
177
  }
175
178
  useEffect(t13, t14);
176
179
  let t15;
177
- if ($[21] !== focusBackOnExit) {
180
+ if ($[22] !== focusBackOnExit) {
178
181
  t15 = function focusLastIfEnabled(event) {
179
182
  if (trapWithoutFocusRef.current) {
180
183
  return;
@@ -188,14 +191,14 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
188
191
  focusLast();
189
192
  }
190
193
  };
191
- $[21] = focusBackOnExit;
192
- $[22] = t15;
194
+ $[22] = focusBackOnExit;
195
+ $[23] = t15;
193
196
  } else {
194
- t15 = $[22];
197
+ t15 = $[23];
195
198
  }
196
199
  const focusLastIfEnabled = t15;
197
200
  let t16;
198
- if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
201
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
199
202
  t16 = function handleBlurIfWithoutFocus(event_0) {
200
203
  if (!trapWithoutFocusRef.current) {
201
204
  return;
@@ -210,13 +213,13 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
210
213
  }
211
214
  focusLast();
212
215
  };
213
- $[23] = t16;
216
+ $[24] = t16;
214
217
  } else {
215
- t16 = $[23];
218
+ t16 = $[24];
216
219
  }
217
220
  const handleBlurIfWithoutFocus = t16;
218
221
  let t17;
219
- if ($[24] !== focusBackOnExit) {
222
+ if ($[25] !== focusBackOnExit) {
220
223
  t17 = function restoreFocusOrFocusFirst() {
221
224
  if (focusBackOnExit) {
222
225
  restoreFocusIfUnmounted(focusFirst);
@@ -224,30 +227,30 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
224
227
  focusFirst();
225
228
  }
226
229
  };
227
- $[24] = focusBackOnExit;
228
- $[25] = t17;
230
+ $[25] = focusBackOnExit;
231
+ $[26] = t17;
229
232
  } else {
230
- t17 = $[25];
233
+ t17 = $[26];
231
234
  }
232
235
  const restoreFocusOrFocusFirst = t17;
233
236
  if (trapDisabled) {
234
237
  let t18;
235
- if ($[26] !== children || $[27] !== restProps) {
238
+ if ($[27] !== children || $[28] !== restProps) {
236
239
  t18 = /*#__PURE__*/jsx("div", {
237
240
  ref: nodeRef,
238
241
  ...restProps,
239
242
  children: children
240
243
  });
241
- $[26] = children;
242
- $[27] = restProps;
243
- $[28] = t18;
244
+ $[27] = children;
245
+ $[28] = restProps;
246
+ $[29] = t18;
244
247
  } else {
245
- t18 = $[28];
248
+ t18 = $[29];
246
249
  }
247
250
  return t18;
248
251
  }
249
252
  let t18;
250
- if ($[29] !== focusLastIfEnabled) {
253
+ if ($[30] !== focusLastIfEnabled) {
251
254
  t18 = /*#__PURE__*/jsx("div", {
252
255
  tabIndex: 0,
253
256
  ref: trapButtonNodeRef,
@@ -256,40 +259,40 @@ const TabTrap = /*#__PURE__*/forwardRef(function TabTrap(t0, ref) {
256
259
  onBlur: handleBlurIfWithoutFocus,
257
260
  "data-trap-button": true
258
261
  });
259
- $[29] = focusLastIfEnabled;
260
- $[30] = t18;
262
+ $[30] = focusLastIfEnabled;
263
+ $[31] = t18;
261
264
  } else {
262
- t18 = $[30];
265
+ t18 = $[31];
263
266
  }
264
267
  let t19;
265
- if ($[31] !== restoreFocusOrFocusFirst) {
268
+ if ($[32] !== restoreFocusOrFocusFirst) {
266
269
  t19 = /*#__PURE__*/jsx("div", {
267
270
  tabIndex: 0,
268
271
  onFocus: restoreFocusOrFocusFirst,
269
272
  "data-trap-button": true
270
273
  });
271
- $[31] = restoreFocusOrFocusFirst;
272
- $[32] = t19;
274
+ $[32] = restoreFocusOrFocusFirst;
275
+ $[33] = t19;
273
276
  } else {
274
- t19 = $[32];
277
+ t19 = $[33];
275
278
  }
276
279
  let t20;
277
- if ($[33] !== children || $[34] !== restProps || $[35] !== t18 || $[36] !== t19) {
280
+ if ($[34] !== children || $[35] !== restProps || $[36] !== t18 || $[37] !== t19) {
278
281
  t20 = /*#__PURE__*/jsxs("div", {
279
282
  ref: nodeRef,
280
283
  ...restProps,
281
284
  children: [t18, children, t19]
282
285
  });
283
- $[33] = children;
284
- $[34] = restProps;
285
- $[35] = t18;
286
- $[36] = t19;
287
- $[37] = t20;
286
+ $[34] = children;
287
+ $[35] = restProps;
288
+ $[36] = t18;
289
+ $[37] = t19;
290
+ $[38] = t20;
288
291
  } else {
289
- t20 = $[37];
292
+ t20 = $[38];
290
293
  }
291
294
  return t20;
292
- });
295
+ }
293
296
  function _temp(item) {
294
297
  return item.tabIndex >= 0;
295
298
  }
@@ -0,0 +1,36 @@
1
+ import { type ComponentPropsWithRef } from 'react';
2
+ export interface DefaultItemRendererProps {
3
+ /**
4
+ * The index of the `data` item to render.
5
+ */
6
+ index: number;
7
+ /**
8
+ * If true, the row will be focusable with up/down arrow keys.
9
+ * Focus is implemented using the
10
+ * ["roving tabindex"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Guides/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex)
11
+ * technique, that is, only the focused row has `tabIndex={0}`.
12
+ *
13
+ * To focus the row on click or other user interaction, add e.g. `onClick()`
14
+ * and invoke `focusRow(e.currentTarget)` imported from `table-row-focus.ts`.
15
+ */
16
+ keyboardFocusable?: boolean;
17
+ /**
18
+ * Changes the background on hover and applies the pointer cursor.
19
+ * Note that `false` does not mean the row cannot handle `onClick`.
20
+ */
21
+ clickable?: boolean;
22
+ /**
23
+ * If true, the row is highlighted as selected, that is, with the
24
+ * a different background color.
25
+ */
26
+ selected?: boolean;
27
+ /**
28
+ * A level of a nested item. Results in an indent for columns with `indent: true`.
29
+ * 0, negative values, and an unset value mean no indent.
30
+ */
31
+ level?: number;
32
+ }
33
+ /**
34
+ * @see TableProps.renderItem
35
+ */
36
+ export declare function DefaultItemRenderer<T>({ index, keyboardFocusable, clickable, selected, level, ref: userRef, className, ...restProps }: DefaultItemRendererProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element | null;
@@ -0,0 +1,182 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useRef, use } from 'react';
3
+ import classNames from 'classnames';
4
+ import { mergeRefs } from 'react-merge-refs';
5
+ import { CollapseItemIntoSpacerContext, TablePropsContext } from './table-const.js';
6
+ import { useIsIntersectingListener } from '../global/intersection-observer-context.js';
7
+ import { TableRow, TableCell } from './table-primitives.js';
8
+ import { s as styles } from '../_helpers/table.js';
9
+ import { jsx } from 'react/jsx-runtime';
10
+ import '@jetbrains/icons/unsorted-12px';
11
+ import '@jetbrains/icons/arrow-12px-down';
12
+ import '@jetbrains/icons/arrow-12px-up';
13
+ import '@jetbrains/icons/trash-12px';
14
+ import '../icon/icon.js';
15
+ import 'util-deprecate';
16
+ import '../icon/icon.constants.js';
17
+ import '../_helpers/icon-svg.js';
18
+ import '../global/memoize.js';
19
+ import './table-row-focus.js';
20
+
21
+ const INDENT_SIZE = 24;
22
+ /**
23
+ * @see TableProps.renderItem
24
+ */
25
+ function DefaultItemRenderer(t0) {
26
+ const $ = c(35);
27
+ if ($[0] !== "550d56d2b4709142d4ace07b800bfd11367b60c980b981f1e1be21c6b691222c") {
28
+ for (let $i = 0; $i < 35; $i += 1) {
29
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
30
+ }
31
+ $[0] = "550d56d2b4709142d4ace07b800bfd11367b60c980b981f1e1be21c6b691222c";
32
+ }
33
+ let className;
34
+ let clickable;
35
+ let index;
36
+ let keyboardFocusable;
37
+ let level;
38
+ let restProps;
39
+ let selected;
40
+ let userRef;
41
+ if ($[1] !== t0) {
42
+ ({
43
+ index,
44
+ keyboardFocusable,
45
+ clickable,
46
+ selected,
47
+ level,
48
+ ref: userRef,
49
+ className,
50
+ ...restProps
51
+ } = t0);
52
+ $[1] = t0;
53
+ $[2] = className;
54
+ $[3] = clickable;
55
+ $[4] = index;
56
+ $[5] = keyboardFocusable;
57
+ $[6] = level;
58
+ $[7] = restProps;
59
+ $[8] = selected;
60
+ $[9] = userRef;
61
+ } else {
62
+ className = $[2];
63
+ clickable = $[3];
64
+ index = $[4];
65
+ keyboardFocusable = $[5];
66
+ level = $[6];
67
+ restProps = $[7];
68
+ selected = $[8];
69
+ userRef = $[9];
70
+ }
71
+ const localRef = useRef(null);
72
+ const collapseItemIntoSpacer = use(CollapseItemIntoSpacerContext);
73
+ let t1;
74
+ if ($[10] !== collapseItemIntoSpacer) {
75
+ t1 = isIntersecting => {
76
+ if (localRef.current && !isIntersecting) {
77
+ collapseItemIntoSpacer(localRef.current.getBoundingClientRect().height);
78
+ }
79
+ };
80
+ $[10] = collapseItemIntoSpacer;
81
+ $[11] = t1;
82
+ } else {
83
+ t1 = $[11];
84
+ }
85
+ useIsIntersectingListener(localRef, t1);
86
+ const tableProps = use(TablePropsContext);
87
+ if (!tableProps) {
88
+ return null;
89
+ }
90
+ const {
91
+ data,
92
+ columns
93
+ } = tableProps;
94
+ const item = data[index];
95
+ let t2;
96
+ if ($[12] !== userRef) {
97
+ t2 = mergeRefs([userRef, localRef]);
98
+ $[12] = userRef;
99
+ $[13] = t2;
100
+ } else {
101
+ t2 = $[13];
102
+ }
103
+ const t3 = clickable && styles.clickableRow;
104
+ const t4 = selected && styles.selectedRow;
105
+ let t5;
106
+ if ($[14] !== className || $[15] !== t3 || $[16] !== t4) {
107
+ t5 = classNames(className, t3, t4);
108
+ $[14] = className;
109
+ $[15] = t3;
110
+ $[16] = t4;
111
+ $[17] = t5;
112
+ } else {
113
+ t5 = $[17];
114
+ }
115
+ let t6;
116
+ if ($[18] !== columns || $[19] !== data || $[20] !== index || $[21] !== item || $[22] !== level) {
117
+ let t7;
118
+ if ($[24] !== data || $[25] !== index || $[26] !== item || $[27] !== level) {
119
+ t7 = (column, columnIndex) => {
120
+ var _column$renderCell;
121
+ return /*#__PURE__*/jsx(TableCell, {
122
+ className: column.tdClassName?.(item, index, data),
123
+ style: column.indent && level != null && level > 0 ? {
124
+ paddingInlineStart: `${level * INDENT_SIZE}px`
125
+ } : undefined,
126
+ children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex)
127
+ }, column.key);
128
+ };
129
+ $[24] = data;
130
+ $[25] = index;
131
+ $[26] = item;
132
+ $[27] = level;
133
+ $[28] = t7;
134
+ } else {
135
+ t7 = $[28];
136
+ }
137
+ t6 = columns.map(t7);
138
+ $[18] = columns;
139
+ $[19] = data;
140
+ $[20] = index;
141
+ $[21] = item;
142
+ $[22] = level;
143
+ $[23] = t6;
144
+ } else {
145
+ t6 = $[23];
146
+ }
147
+ let t7;
148
+ if ($[29] !== keyboardFocusable || $[30] !== restProps || $[31] !== t2 || $[32] !== t5 || $[33] !== t6) {
149
+ t7 = /*#__PURE__*/jsx(TableRow, {
150
+ ref: t2,
151
+ keyboardFocusable: keyboardFocusable,
152
+ className: t5,
153
+ ...restProps,
154
+ children: t6
155
+ });
156
+ $[29] = keyboardFocusable;
157
+ $[30] = restProps;
158
+ $[31] = t2;
159
+ $[32] = t5;
160
+ $[33] = t6;
161
+ $[34] = t7;
162
+ } else {
163
+ t7 = $[34];
164
+ }
165
+ return t7;
166
+ }
167
+ function getDefaultCellValue(item, columnIndex) {
168
+ if (Array.isArray(item)) {
169
+ var _item$columnIndex;
170
+ return String((_item$columnIndex = item[columnIndex]) !== null && _item$columnIndex !== void 0 ? _item$columnIndex : '');
171
+ }
172
+ if (item !== null && typeof item === 'object') {
173
+ var _Object$values$column;
174
+ return String((_Object$values$column = Object.values(item)[columnIndex]) !== null && _Object$values$column !== void 0 ? _Object$values$column : '');
175
+ }
176
+ if (columnIndex === 0) {
177
+ return String(item);
178
+ }
179
+ return '';
180
+ }
181
+
182
+ export { DefaultItemRenderer };
@@ -0,0 +1,80 @@
1
+ import { type ComponentPropsWithRef } 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
+ * For every prop and component referenced here, see the corresponding docs
7
+ * for detailed behavior.
8
+ *
9
+ * ## Minimal usage
10
+ *
11
+ * You need the following props:
12
+ * - `data`
13
+ * - `getKey`
14
+ * - `columns`
15
+ * - `key`
16
+ * - `name` (not required but needed in most cases)
17
+ * - `renderCell` (not required but needed in most cases)
18
+ *
19
+ * ## Selection
20
+ *
21
+ * Selection is handled on item level via `renderItem` (often with
22
+ * `DefaultItemRenderer`) and its props:
23
+ *
24
+ * - `clickable`
25
+ * - `selected`
26
+ * - `onClick` or `onPointerUp`, etc.
27
+ *
28
+ * You may use the TableSelection from `global/table-selection.ts` for the selection control:
29
+ *
30
+ * - `selected={tableSelection.isSelected(item)}`
31
+ * - `onClick={() => setTableSelection(tableSelection.toggle(item))}`
32
+ *
33
+ * See the stories for examples with this utility.
34
+ *
35
+ * Additionally, for accessibility, you will likely need a cell with a checkbox
36
+ * to toggle item selection.
37
+ *
38
+ * ## Sorting
39
+ *
40
+ * You need the following to support sorting:
41
+ *
42
+ * - Include `<SortButton />` in a column header
43
+ * - Set initial `Column.sortOrder` to `none`. Do not leave `undefined`
44
+ * for accessibility reasons.
45
+ * - Handle `TableProps.onSort` callback in the client code. It is expected
46
+ * to update `columns` by setting the new `sortOrder` value for
47
+ * the corresponding column, and updating the data accordingly.
48
+ *
49
+ * ## Focus
50
+ *
51
+ * The table supports the ["roving tabindex"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Guides/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex)
52
+ * technique to focus rows with the up/down arrow keys and, possibly, with the pointer.
53
+ * To support it, use the following props of the `DefaultItemRenderer`:
54
+ *
55
+ * - `keyboardFocusable`
56
+ * - Possibly `onClick` invoking `focusRow(e.currentTarget)`
57
+ *
58
+ * In your custom row renderer, use `TableRow`, which also has the `keyboardFocusable` prop.
59
+ *
60
+ * ## Deleting columns
61
+ *
62
+ * You need the following to support deleting columns:
63
+ *
64
+ * - Make sure the `column` has a proper `name` or `key` prop, which will be
65
+ * automatically included in the aria-label of `<DeleteColumnButton />`.
66
+ * - Include `<DeleteColumnButton />` in a column header
67
+ * - Handle `TableProps.onColumnDelete` callback in the client code. It is expected
68
+ * to update `columns` by removing the corresponding column.
69
+ *
70
+ * ## Row virtualization
71
+ *
72
+ * To render only rows near the viewport and replace others with spacers, use:
73
+ *
74
+ * - `virtualizeRows`
75
+ * - `scrollerRef` — required when the scrollable container is not the whole document
76
+ * - `estimateHeight` — recommended when rows are expected to be taller than
77
+ * the default height (e.g. multiline or custom content)
78
+ * - Fine-tuning props: `lookaheadPx`, `retentionMarginPx`, `minScrollAndResizeDeltaPx`
79
+ */
80
+ export default function Table<T>(props: TableProps<T> & ComponentPropsWithRef<'table'>): import("react").JSX.Element;