@jetbrains/ring-ui-built 8.0.0-beta.3 → 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.
- package/components/_helpers/heading.js +2 -2
- package/components/_helpers/table.js +1 -1
- package/components/_helpers/theme.js +1 -1
- package/components/alert/alert.js +1 -1
- package/components/auth/iframe-flow.js +1 -1
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/collapsible-group/collapsible-group.d.ts +20 -0
- package/components/collapsible-group/collapsible-group.js +382 -0
- package/components/components/util-stories.js +63 -1
- package/components/data-list/data-list.js +1 -1
- package/components/data-list/title.js +1 -1
- package/components/date-picker/date-popup.js +3 -3
- package/components/dropdown-menu/dropdown-menu.js +6 -6
- package/components/editable-heading/editable-heading.js +122 -109
- package/components/expand/collapsible-group.d.ts +8 -20
- package/components/expand/collapsible-group.js +34 -365
- package/components/global/compose-refs.d.ts +2 -1
- package/components/global/compose-refs.js +44 -8
- package/components/global/focus-sensor-hoc.js +1 -0
- package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
- package/components/global/focus-with-temporary-tabindex.js +23 -0
- package/components/global/intersection-observer-context.d.ts +29 -9
- package/components/global/intersection-observer-context.js +50 -52
- package/components/global/is-within-interactive-element.d.ts +6 -0
- package/components/global/is-within-interactive-element.js +11 -0
- package/components/global/is-within-navigable-element.d.ts +6 -0
- package/components/global/is-within-navigable-element.js +11 -0
- package/components/global/parse-css-duration.d.ts +5 -0
- package/components/global/parse-css-duration.js +14 -0
- package/components/global/rerender-hoc.js +1 -0
- package/components/global/schedule-with-cleanup.d.ts +12 -0
- package/components/global/schedule-with-cleanup.js +36 -0
- package/components/global/table-selection.js +1 -1
- package/components/global/theme.js +1 -1
- package/components/header/header.js +1 -1
- package/components/heading/heading.js +3 -3
- package/components/input/input.d.ts +1 -1
- package/components/internal/column-animation.js +133 -0
- package/components/internal/table-header.js +1109 -0
- package/components/{table/table-virtualize.js → internal/virtual-items.js} +108 -84
- package/components/legacy-table/header-cell.js +2 -2
- package/components/legacy-table/row-with-focus-sensor.js +1 -1
- package/components/legacy-table/row.d.ts +1 -1
- package/components/legacy-table/simple-table.js +1 -1
- package/components/legacy-table/smart-table.js +1 -1
- package/components/legacy-table/table.js +1 -1
- package/components/markdown/markdown.js +2 -2
- package/components/message/message.js +1 -1
- package/components/old-browsers-message/white-list.js +2 -2
- package/components/popup/popup.d.ts +2 -0
- package/components/popup/popup.js +5 -1
- package/components/select/select-popup.d.ts +1 -1
- package/components/select/select.d.ts +1 -1
- package/components/style.css +1 -1
- package/components/table/default-item-renderer.d.ts +23 -10
- package/components/table/default-item-renderer.js +104 -98
- package/components/table/internal/column-animation.d.ts +16 -0
- package/components/table/internal/table-header.d.ts +4 -0
- package/components/table/internal/virtual-items.d.ts +34 -0
- package/components/table/item-virtualization.d.ts +35 -0
- package/components/table/item-virtualization.js +71 -0
- package/components/table/table-const.d.ts +40 -6
- package/components/table/table-const.js +15 -6
- package/components/table/table-primitives.d.ts +9 -16
- package/components/table/table-primitives.js +11 -211
- package/components/table/table-props.d.ts +280 -0
- package/components/table/table-props.js +1 -0
- package/components/table/table.d.ts +205 -209
- package/components/table/table.js +356 -15
- package/components/tooltip/tooltip.js +1 -1
- package/components/user-agreement/service.js +6 -6
- package/components/util-stories.d.ts +26 -0
- package/package.json +2 -2
- package/components/date-picker/use-intersection-observer.d.ts +0 -6
- package/components/date-picker/use-intersection-observer.js +0 -93
- package/components/global/composeRefs.d.ts +0 -6
- package/components/global/composeRefs.js +0 -9
- package/components/table/table-component.d.ts +0 -80
- package/components/table/table-component.js +0 -290
- package/components/table/table-row-focus.d.ts +0 -4
- package/components/table/table-row-focus.js +0 -41
- package/components/table/table-virtualize.d.ts +0 -32
|
@@ -2,6 +2,14 @@ import { c } from 'react/compiler-runtime';
|
|
|
2
2
|
import { useState, useEffect, use, createContext } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
const noopIntersectionObserverHandle = {
|
|
8
|
+
observe: () => () => {}
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Multiple components can share a single `IntersectionObserver` instance through this context.
|
|
12
|
+
*
|
|
5
13
|
* Usage:
|
|
6
14
|
*
|
|
7
15
|
* ```tsx
|
|
@@ -12,33 +20,38 @@ import { useState, useEffect, use, createContext } from 'react';
|
|
|
12
20
|
* function YourComponent() {
|
|
13
21
|
* // Contains the current isIntersecting value
|
|
14
22
|
* const isIntersecting = useIsIntersecting(elementRef);
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
23
|
+
*
|
|
24
|
+
* // Or, to manually work with the IntersectionObserverHandle:
|
|
25
|
+
* const handle = use(IntersectionObserverContext);
|
|
26
|
+
* useEffect(() => {
|
|
27
|
+
* return handle.observe(elementRef.current, isIntersecting => { ... })
|
|
18
28
|
* })
|
|
19
29
|
* }
|
|
20
30
|
* ```
|
|
21
31
|
*/
|
|
22
|
-
const IntersectionObserverContext = /*#__PURE__*/createContext(
|
|
32
|
+
const IntersectionObserverContext = /*#__PURE__*/createContext(noopIntersectionObserverHandle);
|
|
33
|
+
/**
|
|
34
|
+
* Creates an IntersectionObserverHandle suitable for {@link IntersectionObserverContext}.
|
|
35
|
+
*/
|
|
23
36
|
function useIntersectionObserverHandle(rootRef, rootMargin, scrollMargin) {
|
|
24
37
|
const $ = c(6);
|
|
25
|
-
if ($[0] !== "
|
|
38
|
+
if ($[0] !== "22e72f21c77e0579b51b95d0c9cf49c7e0027190e5186ad64aa7f2054bb7eb35") {
|
|
26
39
|
for (let $i = 0; $i < 6; $i += 1) {
|
|
27
40
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
28
41
|
}
|
|
29
|
-
$[0] = "
|
|
42
|
+
$[0] = "22e72f21c77e0579b51b95d0c9cf49c7e0027190e5186ad64aa7f2054bb7eb35";
|
|
30
43
|
}
|
|
31
|
-
const [handle, setHandle] = useState(
|
|
44
|
+
const [handle, setHandle] = useState(noopIntersectionObserverHandle);
|
|
32
45
|
let t0;
|
|
33
46
|
let t1;
|
|
34
47
|
if ($[1] !== rootMargin || $[2] !== rootRef || $[3] !== scrollMargin) {
|
|
35
48
|
t0 = () => {
|
|
36
49
|
const root = rootRef?.current;
|
|
37
|
-
const
|
|
50
|
+
const callbacksByElement = new Map();
|
|
38
51
|
const observer = new IntersectionObserver(entries => {
|
|
39
52
|
for (const entry of entries) {
|
|
40
|
-
const
|
|
41
|
-
|
|
53
|
+
const callbacks = callbacksByElement.get(entry.target);
|
|
54
|
+
callbacks?.forEach(cb => cb(entry.isIntersecting));
|
|
42
55
|
}
|
|
43
56
|
}, {
|
|
44
57
|
root,
|
|
@@ -46,18 +59,31 @@ function useIntersectionObserverHandle(rootRef, rootMargin, scrollMargin) {
|
|
|
46
59
|
scrollMargin: scrollMargin != null ? `${scrollMargin}px` : undefined
|
|
47
60
|
});
|
|
48
61
|
setHandle({
|
|
49
|
-
observe(element,
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
observe(element, onChange) {
|
|
63
|
+
if (!callbacksByElement.has(element)) {
|
|
64
|
+
callbacksByElement.set(element, []);
|
|
65
|
+
observer.observe(element);
|
|
66
|
+
}
|
|
67
|
+
callbacksByElement.get(element).push(onChange);
|
|
52
68
|
return () => {
|
|
53
|
-
|
|
54
|
-
|
|
69
|
+
const callbacks_0 = callbacksByElement.get(element);
|
|
70
|
+
if (!callbacks_0) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const index = callbacks_0.indexOf(onChange);
|
|
74
|
+
if (index !== -1) {
|
|
75
|
+
callbacks_0.splice(index, 1);
|
|
76
|
+
}
|
|
77
|
+
if (!callbacks_0.length) {
|
|
78
|
+
callbacksByElement.delete(element);
|
|
79
|
+
observer.unobserve(element);
|
|
80
|
+
}
|
|
55
81
|
};
|
|
56
82
|
}
|
|
57
83
|
});
|
|
58
84
|
return () => {
|
|
59
85
|
observer.disconnect();
|
|
60
|
-
setHandle(
|
|
86
|
+
setHandle(noopIntersectionObserverHandle);
|
|
61
87
|
};
|
|
62
88
|
};
|
|
63
89
|
t1 = [rootRef, rootMargin, scrollMargin];
|
|
@@ -73,13 +99,16 @@ function useIntersectionObserverHandle(rootRef, rootMargin, scrollMargin) {
|
|
|
73
99
|
useEffect(t0, t1);
|
|
74
100
|
return handle;
|
|
75
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Returns whether the referenced element is currently intersecting.
|
|
104
|
+
*/
|
|
76
105
|
function useIsIntersecting(elementRef) {
|
|
77
106
|
const $ = c(5);
|
|
78
|
-
if ($[0] !== "
|
|
107
|
+
if ($[0] !== "22e72f21c77e0579b51b95d0c9cf49c7e0027190e5186ad64aa7f2054bb7eb35") {
|
|
79
108
|
for (let $i = 0; $i < 5; $i += 1) {
|
|
80
109
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
81
110
|
}
|
|
82
|
-
$[0] = "
|
|
111
|
+
$[0] = "22e72f21c77e0579b51b95d0c9cf49c7e0027190e5186ad64aa7f2054bb7eb35";
|
|
83
112
|
}
|
|
84
113
|
const handle = use(IntersectionObserverContext);
|
|
85
114
|
const [isIntersecting, setIsIntersecting] = useState(false);
|
|
@@ -88,12 +117,12 @@ function useIsIntersecting(elementRef) {
|
|
|
88
117
|
if ($[1] !== elementRef || $[2] !== handle) {
|
|
89
118
|
t0 = () => {
|
|
90
119
|
const element = elementRef.current;
|
|
91
|
-
if (!element
|
|
120
|
+
if (!element) {
|
|
92
121
|
return;
|
|
93
122
|
}
|
|
94
123
|
return handle.observe(element, setIsIntersecting);
|
|
95
124
|
};
|
|
96
|
-
t1 = [handle, elementRef
|
|
125
|
+
t1 = [handle, elementRef];
|
|
97
126
|
$[1] = elementRef;
|
|
98
127
|
$[2] = handle;
|
|
99
128
|
$[3] = t0;
|
|
@@ -105,36 +134,5 @@ function useIsIntersecting(elementRef) {
|
|
|
105
134
|
useEffect(t0, t1);
|
|
106
135
|
return isIntersecting;
|
|
107
136
|
}
|
|
108
|
-
function useIsIntersectingListener(elementRef, onChange) {
|
|
109
|
-
const $ = c(6);
|
|
110
|
-
if ($[0] !== "dfabcb1b8108e1a7f2a2e74a1ab9f1d1069e1f7ab04eda46b950789426c929c9") {
|
|
111
|
-
for (let $i = 0; $i < 6; $i += 1) {
|
|
112
|
-
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
113
|
-
}
|
|
114
|
-
$[0] = "dfabcb1b8108e1a7f2a2e74a1ab9f1d1069e1f7ab04eda46b950789426c929c9";
|
|
115
|
-
}
|
|
116
|
-
const handle = use(IntersectionObserverContext);
|
|
117
|
-
let t0;
|
|
118
|
-
let t1;
|
|
119
|
-
if ($[1] !== elementRef || $[2] !== handle || $[3] !== onChange) {
|
|
120
|
-
t0 = () => {
|
|
121
|
-
const element = elementRef.current;
|
|
122
|
-
if (!element || !handle) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
return handle.observe(element, onChange);
|
|
126
|
-
};
|
|
127
|
-
t1 = [handle, elementRef, onChange];
|
|
128
|
-
$[1] = elementRef;
|
|
129
|
-
$[2] = handle;
|
|
130
|
-
$[3] = onChange;
|
|
131
|
-
$[4] = t0;
|
|
132
|
-
$[5] = t1;
|
|
133
|
-
} else {
|
|
134
|
-
t0 = $[4];
|
|
135
|
-
t1 = $[5];
|
|
136
|
-
}
|
|
137
|
-
useEffect(t0, t1);
|
|
138
|
-
}
|
|
139
137
|
|
|
140
|
-
export { IntersectionObserverContext, useIntersectionObserverHandle, useIsIntersecting
|
|
138
|
+
export { IntersectionObserverContext, useIntersectionObserverHandle, useIsIntersecting };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If this function returns `false`, the event may be interpreted as a click
|
|
3
|
+
* or tap on a "empty space" rather than on an interactive element such as
|
|
4
|
+
* a button or a link.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isWithinInteractiveElement(target: EventTarget | null): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const interactiveSelector = ['a', 'button', 'details', 'input', 'label', 'option', 'select', 'summary', 'textarea', '[contenteditable]', '[role="button"]', '[role="checkbox"]', '[role="link"]', '[role="radio"]', '[role="switch"]', '[role="tab"]'].join();
|
|
2
|
+
/**
|
|
3
|
+
* If this function returns `false`, the event may be interpreted as a click
|
|
4
|
+
* or tap on a "empty space" rather than on an interactive element such as
|
|
5
|
+
* a button or a link.
|
|
6
|
+
*/
|
|
7
|
+
function isWithinInteractiveElement(target) {
|
|
8
|
+
return target instanceof Element && target.closest(interactiveSelector) != null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { isWithinInteractiveElement };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns whether the event target is within an element that is expected to
|
|
3
|
+
* handle keyboard navigation itself, so container-level keyboard shortcuts
|
|
4
|
+
* should generally be ignored.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isWithinNavigableElement(target: EventTarget | null): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const navigableSelector = ['input:not([type="button"]):not([type="checkbox"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="reset"]):not([type="submit"])', 'textarea', 'select', '[contenteditable]', '[role="combobox"]', '[role="grid"]', '[role="listbox"]', '[role="menu"]', '[role="menubar"]', '[role="radiogroup"]', '[role="searchbox"]', '[role="slider"]', '[role="spinbutton"]', '[role="tablist"]', '[role="textbox"]', '[role="tree"]', '[role="treegrid"]'].join();
|
|
2
|
+
/**
|
|
3
|
+
* Returns whether the event target is within an element that is expected to
|
|
4
|
+
* handle keyboard navigation itself, so container-level keyboard shortcuts
|
|
5
|
+
* should generally be ignored.
|
|
6
|
+
*/
|
|
7
|
+
function isWithinNavigableElement(target) {
|
|
8
|
+
return target instanceof Element && target.closest(navigableSelector) != null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { isWithinNavigableElement };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a CSS duration string (e.g., "500ms", "2s") and returns the duration in milliseconds.
|
|
3
|
+
* Returns the `defaultVal` if the input string is not a valid CSS duration.
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseCssDuration(duration: string, defaultVal?: number): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a CSS duration string (e.g., "500ms", "2s") and returns the duration in milliseconds.
|
|
3
|
+
* Returns the `defaultVal` if the input string is not a valid CSS duration.
|
|
4
|
+
*/
|
|
5
|
+
function parseCssDuration(duration, defaultVal = 0) {
|
|
6
|
+
const match = duration.match(/(\d+(\.\d+)?)(s|ms)/);
|
|
7
|
+
if (!match) return defaultVal;
|
|
8
|
+
const value = parseFloat(match[1]);
|
|
9
|
+
const unit = match[3];
|
|
10
|
+
// eslint-disable-next-line no-magic-numbers
|
|
11
|
+
return unit === 's' ? value * 1000 : value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { parseCssDuration };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schedules a timeout and returns a function that cancels it.
|
|
3
|
+
*
|
|
4
|
+
* Useful from React effects.
|
|
5
|
+
*/
|
|
6
|
+
export declare function setTimeoutWithCleanup(callback: () => void, delay?: number): () => void;
|
|
7
|
+
/**
|
|
8
|
+
* Schedules an animation frame and returns a function that cancels it.
|
|
9
|
+
*
|
|
10
|
+
* Useful from React effects.
|
|
11
|
+
*/
|
|
12
|
+
export declare function requestAnimationFrameWithCleanup(callback: () => void): () => void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schedules a timeout and returns a function that cancels it.
|
|
3
|
+
*
|
|
4
|
+
* Useful from React effects.
|
|
5
|
+
*/
|
|
6
|
+
function setTimeoutWithCleanup(callback, delay = 0) {
|
|
7
|
+
let timerId = window.setTimeout(() => {
|
|
8
|
+
callback();
|
|
9
|
+
timerId = null;
|
|
10
|
+
}, delay);
|
|
11
|
+
return () => {
|
|
12
|
+
if (timerId != null) {
|
|
13
|
+
window.clearTimeout(timerId);
|
|
14
|
+
timerId = null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Schedules an animation frame and returns a function that cancels it.
|
|
20
|
+
*
|
|
21
|
+
* Useful from React effects.
|
|
22
|
+
*/
|
|
23
|
+
function requestAnimationFrameWithCleanup(callback) {
|
|
24
|
+
let rafId = requestAnimationFrame(() => {
|
|
25
|
+
callback();
|
|
26
|
+
rafId = null;
|
|
27
|
+
});
|
|
28
|
+
return () => {
|
|
29
|
+
if (rafId != null) {
|
|
30
|
+
cancelAnimationFrame(rafId);
|
|
31
|
+
rafId = null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { requestAnimationFrameWithCleanup, setTimeoutWithCleanup };
|
|
@@ -19,7 +19,7 @@ class TableSelection {
|
|
|
19
19
|
return item.id;
|
|
20
20
|
}
|
|
21
21
|
// If there's no id provided on item and no getKey supplied, fail fast with a clear message
|
|
22
|
-
throw new Error('
|
|
22
|
+
throw new Error('TableSelection: getKey is required when items have no "id" property');
|
|
23
23
|
},
|
|
24
24
|
getChildren = () => [],
|
|
25
25
|
isItemSelectable = () => true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'react/compiler-runtime';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'classnames';
|
|
4
|
-
export { G as GLOBAL_DARK_CLASS_NAME,
|
|
4
|
+
export { G as GLOBAL_DARK_CLASS_NAME, b as ThemeContext, a as ThemeProvider, W as WithThemeClasses, c as applyTheme, T as default, u as useTheme, e as useThemeClasses } from '../_helpers/theme.js';
|
|
5
5
|
import 'react/jsx-runtime';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { T as Theme,
|
|
3
|
+
import { T as Theme, a as ThemeProvider } from '../_helpers/theme.js';
|
|
4
4
|
import { s as styles } from '../_helpers/header.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
export { default as Logo } from './logo.js';
|
|
@@ -2,7 +2,7 @@ import { c } from 'react/compiler-runtime';
|
|
|
2
2
|
import { memo, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import deprecate from 'util-deprecate';
|
|
5
|
-
import {
|
|
5
|
+
import { h as headingStyles } from '../_helpers/heading.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
var Levels;
|
|
@@ -46,7 +46,7 @@ const HeadingMemo = /*#__PURE__*/memo(function Heading(t0) {
|
|
|
46
46
|
const level = t1 === undefined ? Levels.H1 : t1;
|
|
47
47
|
let t2;
|
|
48
48
|
if ($[6] !== className) {
|
|
49
|
-
t2 = classNames(
|
|
49
|
+
t2 = classNames(headingStyles.heading, className);
|
|
50
50
|
$[6] = className;
|
|
51
51
|
$[7] = t2;
|
|
52
52
|
} else {
|
|
@@ -183,7 +183,7 @@ const H4 = /*#__PURE__*/memo(function H4(t0) {
|
|
|
183
183
|
let t1;
|
|
184
184
|
if ($[5] !== bold || $[6] !== className) {
|
|
185
185
|
t1 = classNames(className, {
|
|
186
|
-
[
|
|
186
|
+
[headingStyles.bold]: bold
|
|
187
187
|
});
|
|
188
188
|
$[5] = bold;
|
|
189
189
|
$[6] = className;
|
|
@@ -69,7 +69,7 @@ export declare class Input extends PureComponent<InputProps> {
|
|
|
69
69
|
stretch(el: HTMLElement | null | undefined): void;
|
|
70
70
|
adapt(): void;
|
|
71
71
|
inputRef: (el: HTMLInputElement | HTMLTextAreaElement | null) => void;
|
|
72
|
-
composedInputRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement | HTMLTextAreaElement> | undefined)[]) => (value: T | null) => void>;
|
|
72
|
+
composedInputRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement | HTMLTextAreaElement> | undefined)[]) => (value: T | null) => () => void>;
|
|
73
73
|
clear: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
74
74
|
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
75
75
|
handleTextareaChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { parseCssDuration } from '../global/parse-css-duration.js';
|
|
4
|
+
import { requestAnimationFrameWithCleanup, setTimeoutWithCleanup } from '../global/schedule-with-cleanup.js';
|
|
5
|
+
import { s as styles } from '../_helpers/table.js';
|
|
6
|
+
|
|
7
|
+
const reorderExpectationTimeout = 1000;
|
|
8
|
+
function useColumnAnimation(t0) {
|
|
9
|
+
const $ = c(17);
|
|
10
|
+
if ($[0] !== "3136e2b54bc66931abc9531e502b09d39738e25670fb1469ab6b7e91fc803e97") {
|
|
11
|
+
for (let $i = 0; $i < 17; $i += 1) {
|
|
12
|
+
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
13
|
+
}
|
|
14
|
+
$[0] = "3136e2b54bc66931abc9531e502b09d39738e25670fb1469ab6b7e91fc803e97";
|
|
15
|
+
}
|
|
16
|
+
const {
|
|
17
|
+
disabled,
|
|
18
|
+
tableRef,
|
|
19
|
+
columns
|
|
20
|
+
} = t0;
|
|
21
|
+
const [columnAnimation, setColumnAnimation] = useState(null);
|
|
22
|
+
const pendingColumnReorder = useRef(null);
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[1] !== columns || $[2] !== disabled) {
|
|
25
|
+
t1 = reorderSpec => {
|
|
26
|
+
if (disabled) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const timerId = window.setTimeout(() => {
|
|
30
|
+
pendingColumnReorder.current = null;
|
|
31
|
+
}, reorderExpectationTimeout);
|
|
32
|
+
pendingColumnReorder.current = {
|
|
33
|
+
...reorderSpec,
|
|
34
|
+
timerId,
|
|
35
|
+
columns
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
$[1] = columns;
|
|
39
|
+
$[2] = disabled;
|
|
40
|
+
$[3] = t1;
|
|
41
|
+
} else {
|
|
42
|
+
t1 = $[3];
|
|
43
|
+
}
|
|
44
|
+
const expectColumnReorder = t1;
|
|
45
|
+
let t2;
|
|
46
|
+
let t3;
|
|
47
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
48
|
+
t2 = () => () => {
|
|
49
|
+
if (pendingColumnReorder.current) {
|
|
50
|
+
window.clearTimeout(pendingColumnReorder.current.timerId);
|
|
51
|
+
pendingColumnReorder.current = null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
t3 = [];
|
|
55
|
+
$[4] = t2;
|
|
56
|
+
$[5] = t3;
|
|
57
|
+
} else {
|
|
58
|
+
t2 = $[4];
|
|
59
|
+
t3 = $[5];
|
|
60
|
+
}
|
|
61
|
+
useEffect(t2, t3);
|
|
62
|
+
let t4;
|
|
63
|
+
let t5;
|
|
64
|
+
if ($[6] !== columns || $[7] !== tableRef) {
|
|
65
|
+
t4 = () => {
|
|
66
|
+
const table = tableRef.current;
|
|
67
|
+
if (!table || !pendingColumnReorder.current || columns === pendingColumnReorder.current.columns) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const {
|
|
71
|
+
fromIndex,
|
|
72
|
+
insertionIndex
|
|
73
|
+
} = pendingColumnReorder.current;
|
|
74
|
+
pendingColumnReorder.current = null;
|
|
75
|
+
const columnIndex = fromIndex < insertionIndex ? insertionIndex - 1 : insertionIndex;
|
|
76
|
+
return requestAnimationFrameWithCleanup(() => setColumnAnimation(prev => prev == null ? {
|
|
77
|
+
columnIndex,
|
|
78
|
+
phase: "initial",
|
|
79
|
+
cellClassName: styles.animatedColumnInitial
|
|
80
|
+
} : prev));
|
|
81
|
+
};
|
|
82
|
+
t5 = [columns, tableRef];
|
|
83
|
+
$[6] = columns;
|
|
84
|
+
$[7] = tableRef;
|
|
85
|
+
$[8] = t4;
|
|
86
|
+
$[9] = t5;
|
|
87
|
+
} else {
|
|
88
|
+
t4 = $[8];
|
|
89
|
+
t5 = $[9];
|
|
90
|
+
}
|
|
91
|
+
useEffect(t4, t5);
|
|
92
|
+
let t6;
|
|
93
|
+
let t7;
|
|
94
|
+
if ($[10] !== columnAnimation || $[11] !== tableRef) {
|
|
95
|
+
t6 = () => {
|
|
96
|
+
if (columnAnimation?.phase === "initial") {
|
|
97
|
+
return requestAnimationFrameWithCleanup(() => setColumnAnimation(prev_0 => prev_0 === columnAnimation ? {
|
|
98
|
+
...prev_0,
|
|
99
|
+
phase: "fade-out",
|
|
100
|
+
cellClassName: styles.animatedColumnFadeOut
|
|
101
|
+
} : prev_0));
|
|
102
|
+
}
|
|
103
|
+
if (columnAnimation?.phase === "fade-out") {
|
|
104
|
+
const fadeOutMs = parseCssDuration(window.getComputedStyle(tableRef.current).getPropertyValue("--animated-column-fade-out-duration"));
|
|
105
|
+
return setTimeoutWithCleanup(() => setColumnAnimation(prev_1 => prev_1 === columnAnimation ? null : prev_1), fadeOutMs);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
t7 = [columnAnimation, tableRef];
|
|
109
|
+
$[10] = columnAnimation;
|
|
110
|
+
$[11] = tableRef;
|
|
111
|
+
$[12] = t6;
|
|
112
|
+
$[13] = t7;
|
|
113
|
+
} else {
|
|
114
|
+
t6 = $[12];
|
|
115
|
+
t7 = $[13];
|
|
116
|
+
}
|
|
117
|
+
useEffect(t6, t7);
|
|
118
|
+
let t8;
|
|
119
|
+
if ($[14] !== columnAnimation || $[15] !== expectColumnReorder) {
|
|
120
|
+
t8 = {
|
|
121
|
+
columnAnimation,
|
|
122
|
+
expectColumnReorder
|
|
123
|
+
};
|
|
124
|
+
$[14] = columnAnimation;
|
|
125
|
+
$[15] = expectColumnReorder;
|
|
126
|
+
$[16] = t8;
|
|
127
|
+
} else {
|
|
128
|
+
t8 = $[16];
|
|
129
|
+
}
|
|
130
|
+
return t8;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { useColumnAnimation };
|