@astryxdesign/core 0.1.7-canary.fb9c68c → 0.1.7
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/README.md +15 -24
- package/dist/Collapsible/Collapsible.d.ts +1 -11
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +4 -36
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +3 -4
- package/dist/ContextMenu/index.d.ts +0 -3
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +1 -7
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +4 -8
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +1 -17
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +0 -18
- package/dist/DropdownMenu/index.d.ts +1 -5
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +1 -10
- package/dist/Icon/Icon.d.ts +12 -17
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +20 -28
- package/dist/Outline/Outline.d.ts +3 -69
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +26 -129
- package/dist/Outline/useScrollSpy.d.ts +7 -27
- package/dist/Outline/useScrollSpy.d.ts.map +1 -1
- package/dist/Outline/useScrollSpy.js +70 -202
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -2
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +0 -2
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/index.d.ts +0 -2
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +0 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +2 -24
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +7 -18
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +3 -6
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +1 -8
- package/dist/astryx.css +2 -18
- package/dist/astryx.umd.js +48 -48
- package/dist/astryx.umd.js.map +4 -4
- package/dist/theme/Theme.js +1 -1
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.js +1 -1
- package/dist/theme/hct.d.ts +1 -0
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +3 -0
- package/locales/en.json +0 -28
- package/locales/pseudo.json +0 -21
- package/package.json +1 -3
- package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
- package/src/Collapsible/Collapsible.doc.mjs +0 -7
- package/src/Collapsible/Collapsible.test.tsx +0 -80
- package/src/Collapsible/Collapsible.tsx +5 -58
- package/src/ContextMenu/ContextMenu.test.tsx +1 -75
- package/src/ContextMenu/ContextMenu.tsx +5 -10
- package/src/ContextMenu/index.ts +0 -15
- package/src/DropdownMenu/DropdownMenu.doc.mjs +0 -23
- package/src/DropdownMenu/DropdownMenu.tsx +6 -11
- package/src/DropdownMenu/DropdownMenuContext.tsx +1 -29
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +1 -7
- package/src/DropdownMenu/index.ts +3 -23
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/FieldLabel.doc.mjs +1 -1
- package/src/Icon/Icon.test.tsx +0 -46
- package/src/Icon/Icon.tsx +24 -37
- package/src/NumberInput/NumberInput.doc.mjs +2 -2
- package/src/Outline/Outline.doc.mjs +3 -123
- package/src/Outline/Outline.test.tsx +0 -735
- package/src/Outline/Outline.tsx +33 -184
- package/src/Outline/useScrollSpy.ts +72 -248
- package/src/Selector/SelectorOption.doc.mjs +1 -1
- package/src/SideNav/SideNavItem.doc.mjs +2 -2
- package/src/Switch/Switch.doc.mjs +1 -1
- package/src/TabList/Tab.tsx +1 -5
- package/src/TabList/TabList.doc.mjs +3 -3
- package/src/TabList/TabList.test.tsx +0 -66
- package/src/TabList/TabList.tsx +0 -8
- package/src/TabList/TabMenu.tsx +1 -4
- package/src/Table/Table.doc.mjs +0 -2
- package/src/Table/index.ts +0 -7
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +1 -90
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +5 -37
- package/src/Table/plugins/sortable/useTableSortable.test.tsx +9 -95
- package/src/Table/plugins/sortable/useTableSortable.tsx +7 -23
- package/src/Table/useBaseTablePlugins.ts +2 -6
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/Toolbar/Toolbar.tsx +3 -10
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +1 -1
- package/src/theme/defineTheme.ts +1 -1
- package/src/theme/hct.ts +4 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +0 -89
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +0 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +0 -170
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +0 -69
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +0 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +0 -70
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +0 -69
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +0 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +0 -178
- package/dist/DropdownMenu/menuItemRoles.d.ts +0 -13
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +0 -1
- package/dist/DropdownMenu/menuItemRoles.js +0 -15
- package/dist/Table/plugins/tree/index.d.ts +0 -5
- package/dist/Table/plugins/tree/index.d.ts.map +0 -1
- package/dist/Table/plugins/tree/index.js +0 -4
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +0 -38
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +0 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +0 -358
- package/dist/Table/plugins/tree/useTableTreeState.d.ts +0 -51
- package/dist/Table/plugins/tree/useTableTreeState.d.ts.map +0 -1
- package/dist/Table/plugins/tree/useTableTreeState.js +0 -175
- package/scripts/postinstall.mjs +0 -93
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +0 -95
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +0 -237
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +0 -80
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +0 -119
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +0 -80
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +0 -232
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +0 -163
- package/src/DropdownMenu/menuItemRoles.ts +0 -22
- package/src/Table/plugins/tree/index.ts +0 -12
- package/src/Table/plugins/tree/useTableTreeData-perf.test.tsx +0 -163
- package/src/Table/plugins/tree/useTableTreeData.test.tsx +0 -594
- package/src/Table/plugins/tree/useTableTreeData.tsx +0 -495
- package/src/Table/plugins/tree/useTableTreeState.test.tsx +0 -636
- package/src/Table/plugins/tree/useTableTreeState.tsx +0 -253
- package/src/Table/useTableTreeData.doc.mjs +0 -75
- package/src/Table/useTableTreeState.doc.mjs +0 -98
- package/src/postinstall.test.mjs +0 -71
|
@@ -10,38 +10,15 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Drives the active outline item from scroll position. On each scroll
|
|
12
12
|
* (rAF-throttled) it reads live heading positions and marks the last heading
|
|
13
|
-
* whose top has passed its activation line
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* The activation line and the scroll landing are the same number, computed once
|
|
19
|
-
* in `getRestingTop`: scroll-root top + `offset` (a fixed header overlaying the
|
|
20
|
-
* root) + the heading's own `scroll-margin-top`. A heading therefore activates
|
|
21
|
-
* exactly where navigating to it puts it. `offset` and `scroll-margin-top`
|
|
22
|
-
* compose — the header, then the breathing room below it — they do not
|
|
23
|
-
* duplicate each other.
|
|
24
|
-
*
|
|
25
|
-
* It also owns the single navigation path (`scrollTo`), shared by click and
|
|
26
|
-
* keyboard activation: it announces the jump, suppresses scroll-spy for the
|
|
27
|
-
* duration of the programmatic scroll (so the indicator doesn't chase it), and
|
|
28
|
-
* resolves when the scroll settles — via `scrollend` where supported, or a
|
|
29
|
-
* timeout fallback where it is not.
|
|
30
|
-
*
|
|
31
|
-
* The scroll root is the `scrollContainerRef` element when provided, otherwise
|
|
32
|
-
* the nearest scrollable ancestor of the outline, otherwise the viewport.
|
|
13
|
+
* whose top has passed its activation line (its own scroll-margin-top, i.e.
|
|
14
|
+
* where it lands when navigated to). This is stable — it never compares stale
|
|
15
|
+
* cached positions — so the indicator moves monotonically instead of jumping.
|
|
16
|
+
* Defaults to the first item at the top and the last item at the bottom so
|
|
17
|
+
* short final sections still activate.
|
|
33
18
|
*
|
|
34
19
|
* SYNC: When modified, update /packages/core/src/Outline/Outline.tsx
|
|
35
20
|
*/
|
|
36
21
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
37
|
-
/**
|
|
38
|
-
* How long to wait for a programmatic smooth scroll to settle when the
|
|
39
|
-
* `scrollend` event never arrives — either because the browser does not
|
|
40
|
-
* support it (Safari at time of writing) or because the target was already in
|
|
41
|
-
* position, so no scroll happened at all and no events were emitted.
|
|
42
|
-
*/
|
|
43
|
-
const SCROLL_SETTLE_TIMEOUT_MS = 1200;
|
|
44
|
-
|
|
45
22
|
/** Keys that scroll the viewport — used to detect a manual scroll intent. */
|
|
46
23
|
const SCROLL_KEYS = new Set(['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' ', 'Spacebar']);
|
|
47
24
|
function getScrollableAncestor(element) {
|
|
@@ -58,69 +35,20 @@ function getScrollableAncestor(element) {
|
|
|
58
35
|
return null;
|
|
59
36
|
}
|
|
60
37
|
|
|
61
|
-
/** The element's own `scroll-margin-top` in px (0 when unset). */
|
|
62
|
-
function getScrollMarginTop(element) {
|
|
63
|
-
return Number.parseFloat(window.getComputedStyle(element).scrollMarginTop) || 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** The top of the scroll root in viewport coordinates (0 for the viewport). */
|
|
67
|
-
function getRootTop(scrollRoot) {
|
|
68
|
-
return scrollRoot != null ? scrollRoot.getBoundingClientRect().top : 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Where a heading comes to rest, in viewport coordinates: below the fixed
|
|
73
|
-
* header (`offset`) and below its own `scroll-margin-top` breathing room.
|
|
74
|
-
*
|
|
75
|
-
* This is the single source of truth shared by the activation line and the
|
|
76
|
-
* scroll landing — the two must agree, or a heading activates somewhere other
|
|
77
|
-
* than where navigating to it puts it.
|
|
78
|
-
*/
|
|
79
|
-
function getRestingTop(target, scrollRoot, offset) {
|
|
80
|
-
return getRootTop(scrollRoot) + offset + getScrollMarginTop(target);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Bring `target` to rest at the top of the scroll root, below any fixed header.
|
|
85
|
-
*
|
|
86
|
-
* With no `offset`, this is the CSS-native path: `scrollIntoView` already
|
|
87
|
-
* honors the heading's `scroll-margin-top`, and it walks *every* scrollable
|
|
88
|
-
* ancestor, so the browser does it better than we can.
|
|
89
|
-
*
|
|
90
|
-
* An `offset` describes a fixed header overlaying the top of the scroll root —
|
|
91
|
-
* which the browser cannot know about, so `scrollIntoView` would park the
|
|
92
|
-
* heading underneath it, hidden. Compute the landing explicitly instead, from
|
|
93
|
-
* the same {@link getRestingTop} the activation line uses.
|
|
94
|
-
*/
|
|
95
|
-
function scrollToTarget(target, scrollRoot, scrollTarget, offset) {
|
|
96
|
-
if (offset === 0) {
|
|
97
|
-
target.scrollIntoView({
|
|
98
|
-
behavior: 'smooth',
|
|
99
|
-
block: 'start'
|
|
100
|
-
});
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const delta = target.getBoundingClientRect().top - getRestingTop(target, scrollRoot, offset);
|
|
104
|
-
scrollTarget.scrollBy({
|
|
105
|
-
top: delta,
|
|
106
|
-
behavior: 'smooth'
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
38
|
/**
|
|
111
39
|
* Resolve the active heading id from current scroll position.
|
|
112
40
|
*
|
|
113
|
-
* A heading is "passed" once its top reaches its activation line —
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* the
|
|
117
|
-
*
|
|
118
|
-
* the first), the first item is active; at the bottom, the last item is active.
|
|
41
|
+
* A heading is "passed" once its top reaches its activation line — the scroll
|
|
42
|
+
* root's top plus the heading's own scroll-margin-top. The active heading is
|
|
43
|
+
* the last passed one (headings are in document order). When none have passed
|
|
44
|
+
* (scrolled above the first), the first item is active; at the bottom, the
|
|
45
|
+
* last item is active.
|
|
119
46
|
*/
|
|
120
|
-
function resolveActiveId(items, scrollRoot
|
|
47
|
+
function resolveActiveId(items, scrollRoot) {
|
|
121
48
|
if (items.length === 0) {
|
|
122
49
|
return undefined;
|
|
123
50
|
}
|
|
51
|
+
const rootTop = scrollRoot != null ? scrollRoot.getBoundingClientRect().top : 0;
|
|
124
52
|
const atBottom = scrollRoot != null ? scrollRoot.scrollTop + scrollRoot.clientHeight >= scrollRoot.scrollHeight - 2 : window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 2;
|
|
125
53
|
if (atBottom) {
|
|
126
54
|
return items[items.length - 1].id;
|
|
@@ -131,10 +59,9 @@ function resolveActiveId(items, scrollRoot, offset) {
|
|
|
131
59
|
if (element == null) {
|
|
132
60
|
continue;
|
|
133
61
|
}
|
|
134
|
-
|
|
135
|
-
// 1px of tolerance absorbs sub-pixel rounding after a scroll lands.
|
|
136
62
|
const top = element.getBoundingClientRect().top;
|
|
137
|
-
|
|
63
|
+
const marginTop = Number.parseFloat(window.getComputedStyle(element).scrollMarginTop) || 0;
|
|
64
|
+
if (top <= rootTop + marginTop + 1) {
|
|
138
65
|
activeId = item.id;
|
|
139
66
|
} else {
|
|
140
67
|
break;
|
|
@@ -146,23 +73,17 @@ export function useScrollSpy({
|
|
|
146
73
|
activeId,
|
|
147
74
|
items,
|
|
148
75
|
onActiveIdChange,
|
|
149
|
-
rootRef
|
|
150
|
-
offset = 0,
|
|
151
|
-
scrollContainerRef,
|
|
152
|
-
hasScrollOnClick = true,
|
|
153
|
-
onNavigateStart,
|
|
154
|
-
onNavigateEnd
|
|
76
|
+
rootRef
|
|
155
77
|
}) {
|
|
156
78
|
const isControlled = activeId !== undefined;
|
|
157
79
|
const [uncontrolledActiveId, setUncontrolledActiveId] = useState(items[0]?.id);
|
|
158
80
|
const activeIdRef = useRef(activeId);
|
|
159
|
-
// While true, scroll-spy ignores scroll updates because a
|
|
160
|
-
//
|
|
81
|
+
// While true, scroll-spy ignores scroll updates because a click is driving a
|
|
82
|
+
// programmatic scroll. Released when that scroll settles or the user scrolls.
|
|
161
83
|
const suppressRef = useRef(false);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
//
|
|
165
|
-
// the user scrolls during the programmatic scroll.
|
|
84
|
+
const releaseSuppressionRef = useRef(null);
|
|
85
|
+
// Latest scroll-position resolver, so the click handler can resume tracking
|
|
86
|
+
// when the user scrolls during a programmatic scroll.
|
|
166
87
|
const syncRef = useRef(null);
|
|
167
88
|
// Keep latest items/callback in refs so the scroll listener effect doesn't
|
|
168
89
|
// re-subscribe on every render (items is a fresh array each render).
|
|
@@ -172,20 +93,11 @@ export function useScrollSpy({
|
|
|
172
93
|
onActiveIdChangeRef.current = onActiveIdChange;
|
|
173
94
|
const itemIds = items.map(item => item.id).join('\n');
|
|
174
95
|
activeIdRef.current = isControlled ? activeId : uncontrolledActiveId;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* The element whose scroll position drives the outline: the explicit
|
|
178
|
-
* container when scoped, else the nearest scrollable ancestor, else null
|
|
179
|
-
* (meaning the viewport).
|
|
180
|
-
*/
|
|
181
|
-
const getScrollRoot = useCallback(() => {
|
|
182
|
-
return scrollContainerRef?.current ?? getScrollableAncestor(rootRef.current);
|
|
183
|
-
}, [rootRef, scrollContainerRef]);
|
|
184
96
|
useEffect(() => {
|
|
185
97
|
if (isControlled || typeof window === 'undefined') {
|
|
186
98
|
return;
|
|
187
99
|
}
|
|
188
|
-
const scrollRoot =
|
|
100
|
+
const scrollRoot = getScrollableAncestor(rootRef.current);
|
|
189
101
|
const scrollTarget = scrollRoot ?? window;
|
|
190
102
|
let frame = 0;
|
|
191
103
|
const update = () => {
|
|
@@ -193,7 +105,7 @@ export function useScrollSpy({
|
|
|
193
105
|
if (suppressRef.current) {
|
|
194
106
|
return;
|
|
195
107
|
}
|
|
196
|
-
const nextActiveId = resolveActiveId(itemsRef.current, scrollRoot
|
|
108
|
+
const nextActiveId = resolveActiveId(itemsRef.current, scrollRoot);
|
|
197
109
|
if (nextActiveId != null && nextActiveId !== activeIdRef.current) {
|
|
198
110
|
activeIdRef.current = nextActiveId;
|
|
199
111
|
setUncontrolledActiveId(nextActiveId);
|
|
@@ -221,12 +133,12 @@ export function useScrollSpy({
|
|
|
221
133
|
cancelAnimationFrame(frame);
|
|
222
134
|
}
|
|
223
135
|
};
|
|
224
|
-
}, [isControlled, itemIds,
|
|
136
|
+
}, [isControlled, itemIds, rootRef]);
|
|
225
137
|
|
|
226
|
-
// Tear down any
|
|
138
|
+
// Tear down any pending suppression listeners when the Outline unmounts.
|
|
227
139
|
useEffect(() => {
|
|
228
140
|
return () => {
|
|
229
|
-
|
|
141
|
+
releaseSuppressionRef.current?.();
|
|
230
142
|
};
|
|
231
143
|
}, []);
|
|
232
144
|
const setActiveId = nextActiveId => {
|
|
@@ -235,112 +147,68 @@ export function useScrollSpy({
|
|
|
235
147
|
}
|
|
236
148
|
onActiveIdChange?.(nextActiveId);
|
|
237
149
|
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
return false;
|
|
150
|
+
const lockActiveId = useCallback(clickedId => {
|
|
151
|
+
if (typeof window === 'undefined') {
|
|
152
|
+
setUncontrolledActiveId(clickedId);
|
|
153
|
+
activeIdRef.current = clickedId;
|
|
154
|
+
onActiveIdChangeRef.current?.(clickedId);
|
|
155
|
+
return;
|
|
245
156
|
}
|
|
246
157
|
|
|
247
|
-
//
|
|
248
|
-
//
|
|
249
|
-
//
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
// The consumer owns the active state — notify only.
|
|
254
|
-
setActiveId(id);
|
|
255
|
-
} else {
|
|
256
|
-
// Freeze the indicator during the programmatic scroll instead of moving
|
|
257
|
-
// it immediately: it lands on the target once the scroll settles, so it
|
|
258
|
-
// doesn't chase the scroll through intervening sections.
|
|
259
|
-
suppressRef.current = true;
|
|
260
|
-
}
|
|
261
|
-
const scrollRoot = getScrollRoot();
|
|
262
|
-
const scrollTarget = scrollRoot ?? window;
|
|
158
|
+
// Freeze the indicator during the programmatic smooth scroll instead of
|
|
159
|
+
// moving it immediately — it lands on the clicked item once the scroll
|
|
160
|
+
// settles, so it doesn't chase the scroll through intervening sections.
|
|
161
|
+
suppressRef.current = true;
|
|
162
|
+
// Replace any in-flight handlers from a previous click.
|
|
163
|
+
releaseSuppressionRef.current?.();
|
|
263
164
|
let settleTimer = 0;
|
|
264
|
-
let isSettled = false;
|
|
265
165
|
const cleanup = () => {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
166
|
+
window.removeEventListener('scrollend', onSettle);
|
|
167
|
+
window.removeEventListener('wheel', onManual);
|
|
168
|
+
window.removeEventListener('touchmove', onManual);
|
|
269
169
|
window.removeEventListener('keydown', onKeyDown);
|
|
270
170
|
if (settleTimer !== 0) {
|
|
271
171
|
clearTimeout(settleTimer);
|
|
272
172
|
settleTimer = 0;
|
|
273
173
|
}
|
|
274
|
-
|
|
174
|
+
releaseSuppressionRef.current = null;
|
|
275
175
|
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
* End the navigation exactly once. `didArrive` is false when the user took
|
|
279
|
-
* over with a manual scroll mid-flight. `onNavigateEnd` fires either way,
|
|
280
|
-
* so every `onNavigateStart` is balanced and a consumer's "navigating"
|
|
281
|
-
* state can never leak.
|
|
282
|
-
*/
|
|
283
|
-
const finish = (didArrive, shouldResume = true) => {
|
|
284
|
-
if (isSettled) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
isSettled = true;
|
|
176
|
+
// Programmatic scroll finished: move the indicator to the clicked item.
|
|
177
|
+
const onSettle = () => {
|
|
288
178
|
cleanup();
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
onNavigateEnd?.(id);
|
|
179
|
+
suppressRef.current = false;
|
|
180
|
+
setUncontrolledActiveId(clickedId);
|
|
181
|
+
activeIdRef.current = clickedId;
|
|
182
|
+
onActiveIdChangeRef.current?.(clickedId);
|
|
183
|
+
};
|
|
184
|
+
// User scrolled mid-flight: hand control back to scroll-position tracking.
|
|
185
|
+
const onManual = () => {
|
|
186
|
+
cleanup();
|
|
187
|
+
suppressRef.current = false;
|
|
188
|
+
syncRef.current?.();
|
|
301
189
|
};
|
|
302
|
-
const onSettle = () => finish(true);
|
|
303
|
-
const onManual = () => finish(false);
|
|
304
190
|
const onKeyDown = event => {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
// manual scroll intent and must not cancel the navigation it just began.
|
|
308
|
-
if (!event.defaultPrevented && SCROLL_KEYS.has(event.key)) {
|
|
309
|
-
finish(false);
|
|
191
|
+
if (SCROLL_KEYS.has(event.key)) {
|
|
192
|
+
onManual();
|
|
310
193
|
}
|
|
311
194
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
settleTimer = window.setTimeout(onSettle, SCROLL_SETTLE_TIMEOUT_MS);
|
|
327
|
-
navigationRef.current = {
|
|
328
|
-
supersede: () => finish(false, false),
|
|
329
|
-
teardown: cleanup
|
|
330
|
-
};
|
|
331
|
-
scrollToTarget(target, scrollRoot, scrollTarget, offset);
|
|
332
|
-
} else {
|
|
333
|
-
// The consumer owns scrolling — there is no scroll to wait for, so the
|
|
334
|
-
// navigation is already at rest. Resolving immediately (instead of
|
|
335
|
-
// waiting on the settle timeout) keeps onNavigateEnd usable for arrival
|
|
336
|
-
// effects even when hasScrollOnClick is false.
|
|
337
|
-
finish(true);
|
|
338
|
-
}
|
|
339
|
-
return true;
|
|
340
|
-
};
|
|
195
|
+
window.addEventListener('scrollend', onSettle, {
|
|
196
|
+
once: true
|
|
197
|
+
});
|
|
198
|
+
window.addEventListener('wheel', onManual, {
|
|
199
|
+
passive: true
|
|
200
|
+
});
|
|
201
|
+
window.addEventListener('touchmove', onManual, {
|
|
202
|
+
passive: true
|
|
203
|
+
});
|
|
204
|
+
window.addEventListener('keydown', onKeyDown);
|
|
205
|
+
// Fallback when scrollend is unsupported or no scroll is needed.
|
|
206
|
+
settleTimer = window.setTimeout(onSettle, 1200);
|
|
207
|
+
releaseSuppressionRef.current = cleanup;
|
|
208
|
+
}, []);
|
|
341
209
|
return {
|
|
342
210
|
activeId: isControlled ? activeId : uncontrolledActiveId,
|
|
343
211
|
setActiveId,
|
|
344
|
-
|
|
212
|
+
lockActiveId
|
|
345
213
|
};
|
|
346
214
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../src/TabList/Tab.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAYzD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAK5C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,MAAM,WAAW,QAAS,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC5D;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../src/TabList/Tab.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAYzD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAK5C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,MAAM,WAAW,QAAS,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC5D;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAoID;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,EAClB,EAAE,EACF,GAAG,EACH,KAAK,EACL,KAAK,EACL,aAAqB,EACrB,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,QAAQ,qBA2GV;yBAzHe,GAAG"}
|
package/dist/TabList/Tab.js
CHANGED
|
@@ -206,10 +206,10 @@ export function Tab({
|
|
|
206
206
|
selected: isSelected ? 'selected' : null
|
|
207
207
|
}), {
|
|
208
208
|
0: {
|
|
209
|
-
className: "x10l6tqk
|
|
209
|
+
className: "x10l6tqk xqmqy1e xnp31yv xmz3bnw x36qwtl xjspbzw x47corl xnpjden xuedmi6 xlr8y92 xjbqb8w xg01cxk"
|
|
210
210
|
},
|
|
211
211
|
1: {
|
|
212
|
-
className: "x10l6tqk
|
|
212
|
+
className: "x10l6tqk xqmqy1e xnp31yv xmz3bnw x36qwtl xjspbzw x47corl xnpjden xuedmi6 xlr8y92 x1ewilqj x1hc1fzr"
|
|
213
213
|
}
|
|
214
214
|
}[!!isSelected << 0])
|
|
215
215
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../src/TabList/TabList.tsx"],"names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C,EACtB,GAAG,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,YAAY,qBAqLd;yBA5Le,OAAO"}
|
package/dist/TabList/TabMenu.js
CHANGED
|
@@ -240,7 +240,7 @@ export function TabMenu({
|
|
|
240
240
|
...mergeProps(themeProps('tab-indicator', {
|
|
241
241
|
selected: 'selected'
|
|
242
242
|
}), {
|
|
243
|
-
className: "x10l6tqk
|
|
243
|
+
className: "x10l6tqk xqmqy1e xnp31yv xmz3bnw x36qwtl xjspbzw x47corl xnpjden xuedmi6 xlr8y92 xowkcby x1hc1fzr"
|
|
244
244
|
})
|
|
245
245
|
})]
|
|
246
246
|
}), popover.render(/*#__PURE__*/_jsxs("div", {
|
package/dist/Table/index.d.ts
CHANGED
|
@@ -26,7 +26,6 @@ export { useTableStickyColumns } from './plugins/stickyColumns';
|
|
|
26
26
|
export { useTableGroupedRows } from './plugins/groupedRows';
|
|
27
27
|
export { useTableRowIndex } from './plugins/rowIndex';
|
|
28
28
|
export { useTableRowExpansion, useTableRowExpansionState, } from './plugins/rowExpansion';
|
|
29
|
-
export { useTableTreeData, useTableTreeState } from './plugins/tree';
|
|
30
29
|
export { resolveContextActions } from './tableContextMenu';
|
|
31
30
|
export { useTableFiltering, useTableFilterState, toSearchFilters, } from './plugins/filtering';
|
|
32
31
|
export { useBaseTablePlugins } from './useBaseTablePlugins';
|
|
@@ -52,6 +51,5 @@ export type { UseTableStickyColumnsConfig } from './plugins/stickyColumns';
|
|
|
52
51
|
export type { UseTableRowExpansionConfig } from './plugins/rowExpansion';
|
|
53
52
|
export type { UseTableRowIndexConfig } from './plugins/rowIndex';
|
|
54
53
|
export type { UseTableGroupedRowsConfig, UseTableGroupedRowsResult, } from './plugins/groupedRows';
|
|
55
|
-
export type { TableTreeRowMeta, UseTableTreeDataConfig, UseTableTreeStateConfig, UseTableTreeStateResult, } from './plugins/tree';
|
|
56
54
|
export type { UseTableFilteringConfig, TableFilterState, TableFilterVariant, TableFilterValue, TableFilterFieldRef, } from './plugins/filtering';
|
|
57
55
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Table/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,2BAA2B,EAAC,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GA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AM,SAAS,CAAC;AACvD,YAAY,EAAC,wBAAwB,EAAC,MAAM,sBAAsB,CAAC;AACnE,YAAY,EACV,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,iCAAiC,EACjC,iCAAiC,GAClC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAC,0BAA0B,EAAC,MAAM,wBAAwB,CAAC;AACvE,YAAY,EAAC,2BAA2B,EAAC,MAAM,yBAAyB,CAAC;AACzE,YAAY,EAAC,0BAA0B,EAAC,MAAM,wBAAwB,CAAC;AACvE,YAAY,EAAC,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EACV,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
package/dist/Table/index.js
CHANGED
|
@@ -29,7 +29,6 @@ export { useTableStickyColumns } from "./plugins/stickyColumns/index.js";
|
|
|
29
29
|
export { useTableGroupedRows } from "./plugins/groupedRows/index.js";
|
|
30
30
|
export { useTableRowIndex } from "./plugins/rowIndex/index.js";
|
|
31
31
|
export { useTableRowExpansion, useTableRowExpansionState } from "./plugins/rowExpansion/index.js";
|
|
32
|
-
export { useTableTreeData, useTableTreeState } from "./plugins/tree/index.js";
|
|
33
32
|
export { resolveContextActions } from "./tableContextMenu.js";
|
|
34
33
|
export { useTableFiltering, useTableFilterState, toSearchFilters } from "./plugins/filtering/index.js";
|
|
35
34
|
export { useBaseTablePlugins } from "./useBaseTablePlugins.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableRowExpansion.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/rowExpansion/useTableRowExpansion.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,aAAa,CAAC;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W,EACX,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,eAAe,GAChB,EAAE,+BAA+B,CAAC,CAAC,CAAC,GAAG,+BAA+B,CAAC,CAAC,CAAC,CAyHzE;AAuGD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpE,MAAM,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACpC,WAAW,CAAC,CAAC,CAAC,CAwOhB"}
|
|
@@ -72,19 +72,12 @@ export function useTableRowExpansionState({
|
|
|
72
72
|
const isExpandable = useCallback(item => getIsItemExpandable ? getIsItemExpandable(item) : getChildren(item).length > 0, [getIsItemExpandable, getChildren]);
|
|
73
73
|
const depthMap = useMemo(() => {
|
|
74
74
|
const map = new Map();
|
|
75
|
-
// Ancestor keys on the current walk path — guards against cyclic data.
|
|
76
|
-
const path = new Set();
|
|
77
75
|
function walk(items, depth) {
|
|
78
76
|
for (const item of items) {
|
|
79
77
|
const key = getRowKey(item);
|
|
80
|
-
if (path.has(key)) {
|
|
81
|
-
continue; // cyclic edge — skip
|
|
82
|
-
}
|
|
83
78
|
map.set(key, depth);
|
|
84
79
|
if (expandedKeys.has(key)) {
|
|
85
|
-
path.add(key);
|
|
86
80
|
walk(getChildren(item), depth + 1);
|
|
87
|
-
path.delete(key);
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
83
|
}
|
|
@@ -93,19 +86,12 @@ export function useTableRowExpansionState({
|
|
|
93
86
|
}, [baseData, getChildren, getRowKey, expandedKeys]);
|
|
94
87
|
const data = useMemo(() => {
|
|
95
88
|
const result = [];
|
|
96
|
-
// Ancestor keys on the current walk path — guards against cyclic data.
|
|
97
|
-
const path = new Set();
|
|
98
89
|
function walk(items) {
|
|
99
90
|
for (const item of items) {
|
|
100
|
-
const key = getRowKey(item);
|
|
101
|
-
if (path.has(key)) {
|
|
102
|
-
continue; // cyclic edge — skip
|
|
103
|
-
}
|
|
104
91
|
result.push(item);
|
|
92
|
+
const key = getRowKey(item);
|
|
105
93
|
if (expandedKeys.has(key)) {
|
|
106
|
-
path.add(key);
|
|
107
94
|
walk(getChildren(item));
|
|
108
|
-
path.delete(key);
|
|
109
95
|
}
|
|
110
96
|
}
|
|
111
97
|
}
|
|
@@ -116,19 +102,11 @@ export function useTableRowExpansionState({
|
|
|
116
102
|
// Every expandable key across the whole tree (drives expand-all).
|
|
117
103
|
const allExpandableKeys = useMemo(() => {
|
|
118
104
|
const keys = [];
|
|
119
|
-
// Ancestor keys on the current walk path — guards against cyclic data.
|
|
120
|
-
const path = new Set();
|
|
121
105
|
function walk(items) {
|
|
122
106
|
for (const item of items) {
|
|
123
|
-
const key = getRowKey(item);
|
|
124
|
-
if (path.has(key)) {
|
|
125
|
-
continue; // cyclic edge — skip
|
|
126
|
-
}
|
|
127
107
|
if (isExpandable(item)) {
|
|
128
|
-
keys.push(
|
|
129
|
-
path.add(key);
|
|
108
|
+
keys.push(getRowKey(item));
|
|
130
109
|
walk(getChildren(item));
|
|
131
|
-
path.delete(key);
|
|
132
110
|
}
|
|
133
111
|
}
|
|
134
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableSortable.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/sortable/useTableSortable.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,WAAW,EAIZ,MAAM,aAAa,CAAC;AAMrB;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,YAAY,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IAC9D,2EAA2E;IAC3E,OAAO,EAAE,QAAQ,CAAC;IAClB,0BAA0B;IAC1B,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IACzD,cAAc,CAAC,QAAQ,CAAC,EAAE,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;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAmND;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChC,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CA2F1D"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTableSortable.tsx
|
|
7
|
-
* @input React, types, Icon, theme tokens
|
|
7
|
+
* @input React, types, Icon, theme tokens
|
|
8
8
|
* @output Exports useTableSortable hook and sort-related types
|
|
9
9
|
* @position Sortable plugin; consumed by Table via plugins prop
|
|
10
10
|
*
|
|
@@ -95,26 +95,16 @@ function getHeaderLabel(column) {
|
|
|
95
95
|
}
|
|
96
96
|
return column.key;
|
|
97
97
|
}
|
|
98
|
-
function buildAriaLabel(
|
|
98
|
+
function buildAriaLabel(column, direction, rank, total) {
|
|
99
99
|
const label = getHeaderLabel(column);
|
|
100
100
|
if (direction == null) {
|
|
101
|
-
return
|
|
102
|
-
label
|
|
103
|
-
});
|
|
101
|
+
return `Sort by ${label}`;
|
|
104
102
|
}
|
|
105
|
-
|
|
103
|
+
let ariaLabel = `Sort by ${label}, sorted ${direction}`;
|
|
106
104
|
if (rank != null && total > 1) {
|
|
107
|
-
|
|
108
|
-
label,
|
|
109
|
-
direction: directionLabel,
|
|
110
|
-
rank,
|
|
111
|
-
total
|
|
112
|
-
});
|
|
105
|
+
ariaLabel += `, priority ${rank} of ${total}`;
|
|
113
106
|
}
|
|
114
|
-
return
|
|
115
|
-
label,
|
|
116
|
-
direction: directionLabel
|
|
117
|
-
});
|
|
107
|
+
return ariaLabel;
|
|
118
108
|
}
|
|
119
109
|
function getNextDirection(current, allowUnsortedState) {
|
|
120
110
|
if (current == null) {
|
|
@@ -136,7 +126,6 @@ function SortHeaderButton({
|
|
|
136
126
|
children,
|
|
137
127
|
configRef
|
|
138
128
|
}) {
|
|
139
|
-
const t = useTranslator();
|
|
140
129
|
const config = configRef.current;
|
|
141
130
|
const sortKey = resolveSortKey(column) ?? '';
|
|
142
131
|
const entryIndex = config.sort.findIndex(e => e.sortKey === sortKey);
|
|
@@ -145,7 +134,7 @@ function SortHeaderButton({
|
|
|
145
134
|
const isMultiSort = config.isMultiSortEnabled === true && config.sort.length > 1;
|
|
146
135
|
const rank = isMultiSort && entryIndex >= 0 ? entryIndex + 1 : null;
|
|
147
136
|
const iconName = direction === 'ascending' ? 'arrowUp' : direction === 'descending' ? 'arrowDown' : 'arrowsUpDown';
|
|
148
|
-
const ariaLabel = buildAriaLabel(
|
|
137
|
+
const ariaLabel = buildAriaLabel(column, direction, rank, config.sort.length);
|
|
149
138
|
const handleClick = e => {
|
|
150
139
|
const cfg = configRef.current;
|
|
151
140
|
const isShift = e.shiftKey && cfg.isMultiSortEnabled;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBaseTablePlugins.d.ts","sourceRoot":"","sources":["../../src/Table/useBaseTablePlugins.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useBaseTablePlugins.d.ts","sourceRoot":"","sources":["../../src/Table/useBaseTablePlugins.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AA6GzC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GACtD,WAAW,CAAC,CAAC,CAAC,EAAE,CA2ClB"}
|
|
@@ -18,15 +18,12 @@
|
|
|
18
18
|
* Canonical order:
|
|
19
19
|
* 1. columnSettings — column filtering (future: transformColumns)
|
|
20
20
|
* 2. sort — header cell sort controls
|
|
21
|
-
* 3.
|
|
22
|
-
* 4.
|
|
23
|
-
* 5. pagination — pagination controls around the table
|
|
21
|
+
* 3. selection — checkbox column + row selection
|
|
22
|
+
* 4. pagination — pagination controls around the table
|
|
24
23
|
*
|
|
25
24
|
* Rationale:
|
|
26
25
|
* - columnSettings filters columns before sort/selection see them
|
|
27
26
|
* - sort adds header cell UI before selection adds its header column
|
|
28
|
-
* - tree wraps the first *user* column before selection prepends its
|
|
29
|
-
* checkbox column, so the expander never lands in the checkbox column
|
|
30
27
|
* - selection adds its column after sort so the checkbox header
|
|
31
28
|
* doesn't get a sort button
|
|
32
29
|
* - pagination wraps the table in context last (outermost provider)
|
|
@@ -43,7 +40,7 @@ import { useRef } from 'react';
|
|
|
43
40
|
* Plugins are sorted by their position in this array.
|
|
44
41
|
* Unknown names are appended after the known set.
|
|
45
42
|
*/
|
|
46
|
-
const PLUGIN_ORDER = ['columnSettings', 'sort', '
|
|
43
|
+
const PLUGIN_ORDER = ['columnSettings', 'sort', 'selection', 'pagination'];
|
|
47
44
|
|
|
48
45
|
/** Lookup map for O(1) ordering checks. */
|
|
49
46
|
const PLUGIN_ORDER_MAP = new Map(PLUGIN_ORDER.map((name, index) => [name, index]));
|