@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.
- package/components/_helpers/anchor.js +1 -1
- package/components/_helpers/avatar-info.js +1 -1
- package/components/_helpers/icon-svg.js +1 -1
- package/components/_helpers/legacy-table.js +3 -0
- package/components/_helpers/tab-link.js +1 -1
- package/components/_helpers/table.js +2 -2
- package/components/_helpers/theme.js +49 -37
- package/components/alert/alert.js +1 -1
- package/components/alert-service/alert-service.js +1 -1
- package/components/auth/auth-core.js +1 -1
- package/components/auth/auth.js +1 -1
- package/components/auth/down-notification.js +1 -1
- package/components/auth/iframe-flow.js +1 -1
- package/components/auth/storage.js +1 -1
- package/components/auth-dialog/auth-dialog.js +1 -1
- package/components/auth-dialog-service/auth-dialog-service.js +2 -2
- package/components/avatar/avatar-info.js +1 -1
- package/components/avatar/avatar.js +1 -1
- package/components/avatar/fallback-avatar.js +1 -1
- package/components/avatar-stack/avatar-stack.js +1 -1
- package/components/banner/banner.js +1 -1
- package/components/button/button.js +1 -1
- package/components/button-group/button-group.js +1 -1
- package/components/checkbox/checkbox.js +1 -1
- package/components/clipboard/clipboard.js +1 -1
- package/components/collapse/collapse-content.js +5 -5
- package/components/collapse/collapse-control.js +5 -5
- package/components/collapse/collapse.js +4 -4
- package/components/confirm/confirm.js +1 -1
- package/components/confirm-service/confirm-service.js +2 -2
- package/components/contenteditable/contenteditable.js +1 -1
- package/components/control-help/control-help.js +1 -1
- package/components/control-label/control-label.js +1 -1
- package/components/data-list/data-list.d.ts +4 -4
- package/components/data-list/data-list.js +3 -3
- package/components/data-list/data-list.mock.d.ts +1 -1
- package/components/data-list/data-list.mock.js +1 -1
- package/components/data-list/item.d.ts +1 -1
- package/components/data-list/item.js +1 -1
- package/components/data-list/selection.d.ts +1 -1
- package/components/data-list/selection.js +2 -2
- package/components/data-list/title.js +1 -1
- package/components/date-picker/date-input.js +1 -1
- package/components/date-picker/date-picker.js +2 -3
- package/components/date-picker/date-popup.js +2 -3
- package/components/date-picker/month-names.js +1 -1
- package/components/date-picker/month-slider.js +1 -1
- package/components/date-picker/month.d.ts +0 -2
- package/components/date-picker/month.js +17 -18
- package/components/date-picker/months.js +43 -35
- package/components/date-picker/use-intersection-observer.js +1 -1
- package/components/date-picker/use-scroll-behavior.js +45 -44
- package/components/date-picker/weekdays.js +1 -1
- package/components/date-picker/years.js +61 -54
- package/components/dialog/dialog.d.ts +2 -2
- package/components/dialog/dialog.js +3 -3
- package/components/dropdown/anchor.js +1 -1
- package/components/dropdown/dropdown.js +1 -1
- package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
- package/components/dropdown-menu/dropdown-menu.js +62 -57
- package/components/editable-heading/editable-heading.d.ts +1 -2
- package/components/editable-heading/editable-heading.js +13 -12
- package/components/error-bubble/error-bubble.js +1 -1
- package/components/error-message/error-message.js +1 -1
- package/components/expand/collapsible-group.d.ts +5 -1
- package/components/expand/collapsible-group.js +15 -14
- package/components/footer/footer.js +1 -1
- package/components/global/create-stateful-context.js +11 -11
- package/components/global/intersection-observer-context.d.ts +26 -0
- package/components/global/intersection-observer-context.js +140 -0
- package/components/global/rerender-hoc.d.ts +4 -2
- package/components/global/rerender-hoc.js +10 -24
- package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
- package/components/{table/selection.js → global/table-selection.js} +4 -4
- package/components/global/theme.d.ts +4 -3
- package/components/global/theme.js +1 -1
- package/components/header/header-icon.js +1 -1
- package/components/header/header.js +1 -1
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -1
- package/components/header/profile.js +1 -1
- package/components/header/services.js +1 -1
- package/components/header/smart-profile.js +1 -1
- package/components/header/smart-services.js +1 -1
- package/components/heading/heading.js +1 -1
- package/components/i18n/i18n-context.js +4 -4
- package/components/icon/icon-svg.js +1 -1
- package/components/icon/icon.js +1 -1
- package/components/icon/index.js +1 -1
- package/components/input/input.js +1 -1
- package/components/island/adaptive-island-hoc.js +3 -3
- package/components/island/content.d.ts +7 -2
- package/components/island/content.js +27 -18
- package/components/island/header.js +1 -1
- package/components/island/island.js +1 -1
- package/components/{table → legacy-table}/cell.js +1 -1
- package/components/{table → legacy-table}/header-cell.js +4 -4
- package/components/{table → legacy-table}/header.js +2 -2
- package/components/{table → legacy-table}/multitable.d.ts +1 -1
- package/components/{table → legacy-table}/row-with-focus-sensor.js +2 -2
- package/components/{table → legacy-table}/row.js +4 -4
- package/components/legacy-table/selection-adapter.d.ts +6 -0
- package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
- package/components/{table → legacy-table}/simple-table.d.ts +2 -2
- package/components/{table → legacy-table}/simple-table.js +4 -4
- package/components/{table → legacy-table}/smart-table.d.ts +5 -5
- package/components/{table → legacy-table}/smart-table.js +5 -5
- package/components/legacy-table/table.d.ts +109 -0
- package/components/legacy-table/table.js +369 -0
- package/components/list/list-item.js +1 -1
- package/components/list/list-users-groups-source.js +1 -1
- package/components/list/list.js +1 -1
- package/components/login-dialog/login-dialog.js +1 -1
- package/components/login-dialog/service.js +2 -2
- package/components/message/message.js +1 -1
- package/components/old-browsers-message/white-list.js +2 -2
- package/components/pager/pager.js +1 -1
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.target.d.ts +3 -2
- package/components/popup/popup.target.js +32 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/query-assist/query-assist-suggestions.js +1 -1
- package/components/query-assist/query-assist.d.ts +3 -1
- package/components/query-assist/query-assist.js +2 -2
- package/components/radio/radio-item.d.ts +3 -3
- package/components/radio/radio-item.js +32 -18
- package/components/radio/radio.d.ts +2 -2
- package/components/radio/radio.js +2 -2
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/chevron-button.js +1 -1
- package/components/select/select-filter.js +1 -1
- package/components/select/select-popup.js +1 -1
- package/components/select/select.d.ts +3 -1
- package/components/select/select.js +1 -1
- package/components/slider/slider.js +100 -96
- package/components/storage/storage-local.js +1 -1
- package/components/storage/storage.js +1 -1
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.d.ts +3 -3
- package/components/tab-trap/tab-trap.js +83 -80
- package/components/table/default-item-renderer.d.ts +36 -0
- package/components/table/default-item-renderer.js +182 -0
- package/components/table/table-component.d.ts +80 -0
- package/components/table/table-component.js +290 -0
- package/components/table/table-const.d.ts +8 -0
- package/components/table/table-const.js +11 -0
- package/components/table/table-primitives.d.ts +28 -0
- package/components/table/table-primitives.js +323 -0
- package/components/table/table-row-focus.d.ts +4 -0
- package/components/table/table-row-focus.js +41 -0
- package/components/table/table-virtualize.d.ts +32 -0
- package/components/table/table-virtualize.js +329 -0
- package/components/table/table.d.ts +206 -104
- package/components/table/table.js +19 -362
- package/components/tabs/collapsible-more.js +1 -1
- package/components/tabs/collapsible-tab.js +1 -1
- package/components/tabs/collapsible-tabs.js +1 -1
- package/components/tabs/dumb-tabs.js +1 -1
- package/components/tabs/smart-tabs.js +1 -1
- package/components/tabs/tab-link.js +1 -1
- package/components/tabs/tabs.js +1 -1
- package/components/tag/tag.js +1 -1
- package/components/tags-input/tags-input.d.ts +3 -1
- package/components/tags-input/tags-input.js +1 -1
- package/components/tags-list/tags-list.js +1 -1
- package/components/toggle/toggle.js +1 -1
- package/components/tooltip/tooltip.js +2 -2
- package/components/upload/upload.d.ts +4 -3
- package/components/upload/upload.js +7 -29
- package/components/user-agreement/service.js +2 -2
- package/components/user-agreement/user-agreement.js +1 -1
- package/components/user-card/card.js +1 -1
- package/components/user-card/smart-user-card-tooltip.js +1 -1
- package/components/user-card/tooltip.js +1 -1
- package/components/user-card/user-card.js +1 -1
- package/package.json +6 -6
- package/components/global/use-event-callback.d.ts +0 -1
- package/components/global/use-event-callback.js +0 -44
- package/components/table/selection-adapter.d.ts +0 -6
- /package/components/{table → legacy-table}/cell.d.ts +0 -0
- /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
- /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
- /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
- /package/components/{table → legacy-table}/header.d.ts +0 -0
- /package/components/{table → legacy-table}/multitable.js +0 -0
- /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
- /package/components/{table → legacy-table}/row.d.ts +0 -0
- /package/components/{table → legacy-table}/selection-adapter.js +0 -0
- /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
|
|
15
|
+
export interface TabTrapObject {
|
|
15
16
|
node: HTMLElement | null;
|
|
16
17
|
}
|
|
17
|
-
|
|
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
|
|
2
|
-
import {
|
|
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
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
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] = "
|
|
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] =
|
|
36
|
-
$[4] =
|
|
37
|
-
$[5] =
|
|
38
|
-
$[6] =
|
|
39
|
-
$[7] =
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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 ($[
|
|
65
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
63
66
|
t5 = () => ({
|
|
64
67
|
node: nodeRef.current
|
|
65
68
|
});
|
|
66
69
|
t6 = [];
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
70
|
+
$[9] = t5;
|
|
71
|
+
$[10] = t6;
|
|
69
72
|
} else {
|
|
70
|
-
t5 = $[
|
|
71
|
-
t6 = $[
|
|
73
|
+
t5 = $[9];
|
|
74
|
+
t6 = $[10];
|
|
72
75
|
}
|
|
73
76
|
useImperativeHandle(ref, t5, t6);
|
|
74
77
|
let t7;
|
|
75
|
-
if ($[
|
|
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
|
-
$[
|
|
89
|
+
$[11] = t7;
|
|
87
90
|
} else {
|
|
88
|
-
t7 = $[
|
|
91
|
+
t7 = $[11];
|
|
89
92
|
}
|
|
90
93
|
const restoreFocusIfUnmounted = t7;
|
|
91
94
|
let t8;
|
|
92
|
-
if ($[
|
|
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
|
-
$[
|
|
108
|
+
$[12] = t8;
|
|
106
109
|
} else {
|
|
107
|
-
t8 = $[
|
|
110
|
+
t8 = $[12];
|
|
108
111
|
}
|
|
109
112
|
const focusElement = t8;
|
|
110
113
|
let t9;
|
|
111
|
-
if ($[
|
|
114
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
112
115
|
t9 = () => focusElement(true);
|
|
113
|
-
$[
|
|
116
|
+
$[13] = t9;
|
|
114
117
|
} else {
|
|
115
|
-
t9 = $[
|
|
118
|
+
t9 = $[13];
|
|
116
119
|
}
|
|
117
120
|
const focusFirst = t9;
|
|
118
121
|
let t10;
|
|
119
|
-
if ($[
|
|
122
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
120
123
|
t10 = () => focusElement(false);
|
|
121
|
-
$[
|
|
124
|
+
$[14] = t10;
|
|
122
125
|
} else {
|
|
123
|
-
t10 = $[
|
|
126
|
+
t10 = $[14];
|
|
124
127
|
}
|
|
125
128
|
const focusLast = t10;
|
|
126
129
|
let t11;
|
|
127
130
|
let t12;
|
|
128
|
-
if ($[
|
|
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
|
-
$[
|
|
137
|
-
$[
|
|
139
|
+
$[15] = t11;
|
|
140
|
+
$[16] = t12;
|
|
138
141
|
} else {
|
|
139
|
-
t11 = $[
|
|
140
|
-
t12 = $[
|
|
142
|
+
t11 = $[15];
|
|
143
|
+
t12 = $[16];
|
|
141
144
|
}
|
|
142
145
|
useEffect(t11, t12);
|
|
143
146
|
let t13;
|
|
144
147
|
let t14;
|
|
145
|
-
if ($[
|
|
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
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
169
|
+
$[17] = autoFocusFirst;
|
|
170
|
+
$[18] = focusBackOnClose;
|
|
171
|
+
$[19] = trapDisabled;
|
|
172
|
+
$[20] = t13;
|
|
173
|
+
$[21] = t14;
|
|
171
174
|
} else {
|
|
172
|
-
t13 = $[
|
|
173
|
-
t14 = $[
|
|
175
|
+
t13 = $[20];
|
|
176
|
+
t14 = $[21];
|
|
174
177
|
}
|
|
175
178
|
useEffect(t13, t14);
|
|
176
179
|
let t15;
|
|
177
|
-
if ($[
|
|
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
|
-
$[
|
|
192
|
-
$[
|
|
194
|
+
$[22] = focusBackOnExit;
|
|
195
|
+
$[23] = t15;
|
|
193
196
|
} else {
|
|
194
|
-
t15 = $[
|
|
197
|
+
t15 = $[23];
|
|
195
198
|
}
|
|
196
199
|
const focusLastIfEnabled = t15;
|
|
197
200
|
let t16;
|
|
198
|
-
if ($[
|
|
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
|
-
$[
|
|
216
|
+
$[24] = t16;
|
|
214
217
|
} else {
|
|
215
|
-
t16 = $[
|
|
218
|
+
t16 = $[24];
|
|
216
219
|
}
|
|
217
220
|
const handleBlurIfWithoutFocus = t16;
|
|
218
221
|
let t17;
|
|
219
|
-
if ($[
|
|
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
|
-
$[
|
|
228
|
-
$[
|
|
230
|
+
$[25] = focusBackOnExit;
|
|
231
|
+
$[26] = t17;
|
|
229
232
|
} else {
|
|
230
|
-
t17 = $[
|
|
233
|
+
t17 = $[26];
|
|
231
234
|
}
|
|
232
235
|
const restoreFocusOrFocusFirst = t17;
|
|
233
236
|
if (trapDisabled) {
|
|
234
237
|
let t18;
|
|
235
|
-
if ($[
|
|
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
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
+
$[27] = children;
|
|
245
|
+
$[28] = restProps;
|
|
246
|
+
$[29] = t18;
|
|
244
247
|
} else {
|
|
245
|
-
t18 = $[
|
|
248
|
+
t18 = $[29];
|
|
246
249
|
}
|
|
247
250
|
return t18;
|
|
248
251
|
}
|
|
249
252
|
let t18;
|
|
250
|
-
if ($[
|
|
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
|
-
$[
|
|
260
|
-
$[
|
|
262
|
+
$[30] = focusLastIfEnabled;
|
|
263
|
+
$[31] = t18;
|
|
261
264
|
} else {
|
|
262
|
-
t18 = $[
|
|
265
|
+
t18 = $[31];
|
|
263
266
|
}
|
|
264
267
|
let t19;
|
|
265
|
-
if ($[
|
|
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
|
-
$[
|
|
272
|
-
$[
|
|
274
|
+
$[32] = restoreFocusOrFocusFirst;
|
|
275
|
+
$[33] = t19;
|
|
273
276
|
} else {
|
|
274
|
-
t19 = $[
|
|
277
|
+
t19 = $[33];
|
|
275
278
|
}
|
|
276
279
|
let t20;
|
|
277
|
-
if ($[
|
|
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
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
286
|
+
$[34] = children;
|
|
287
|
+
$[35] = restProps;
|
|
288
|
+
$[36] = t18;
|
|
289
|
+
$[37] = t19;
|
|
290
|
+
$[38] = t20;
|
|
288
291
|
} else {
|
|
289
|
-
t20 = $[
|
|
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;
|