@cdx-ui/components 0.2.2 → 0.2.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/README.md +4 -2
- package/coverage.svg +1 -1
- package/lib/commonjs/components/Checkbox/index.js.map +1 -1
- package/lib/commonjs/components/Heading/index.js.map +1 -1
- package/lib/commonjs/components/Icon/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/index.js +170 -9
- package/lib/commonjs/components/ListItem/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +36 -1
- package/lib/commonjs/components/ListItem/styles.js.map +1 -1
- package/lib/commonjs/components/Menu/index.js.map +1 -1
- package/lib/commonjs/components/RangeCalendar/index.js.map +1 -1
- package/lib/commonjs/components/ReorderableList/ReorderableListShared.js +91 -0
- package/lib/commonjs/components/ReorderableList/ReorderableListShared.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/index.js +135 -0
- package/lib/commonjs/components/ReorderableList/index.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/index.web.js +233 -0
- package/lib/commonjs/components/ReorderableList/index.web.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/labels.js +47 -0
- package/lib/commonjs/components/ReorderableList/labels.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/reorderItems.js +16 -0
- package/lib/commonjs/components/ReorderableList/reorderItems.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/rowContext.js +42 -0
- package/lib/commonjs/components/ReorderableList/rowContext.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/types.js +6 -0
- package/lib/commonjs/components/ReorderableList/types.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/useReorder.js +131 -0
- package/lib/commonjs/components/ReorderableList/useReorder.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/webDnd.js +64 -0
- package/lib/commonjs/components/ReorderableList/webDnd.js.map +1 -0
- package/lib/commonjs/components/ScopedTheme/index.js.map +1 -1
- package/lib/commonjs/components/Skeleton/index.js.map +1 -1
- package/lib/commonjs/components/TablePagination/index.js.map +1 -1
- package/lib/commonjs/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/Tile/styles.js +1 -1
- package/lib/commonjs/components/Tile/styles.js.map +1 -1
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/reorderable-list.js +17 -0
- package/lib/commonjs/reorderable-list.js.map +1 -0
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/Heading/index.js.map +1 -1
- package/lib/module/components/Icon/index.js.map +1 -1
- package/lib/module/components/ListItem/index.js +163 -14
- package/lib/module/components/ListItem/index.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +35 -0
- package/lib/module/components/ListItem/styles.js.map +1 -1
- package/lib/module/components/Menu/index.js.map +1 -1
- package/lib/module/components/RangeCalendar/index.js.map +1 -1
- package/lib/module/components/ReorderableList/ReorderableListShared.js +86 -0
- package/lib/module/components/ReorderableList/ReorderableListShared.js.map +1 -0
- package/lib/module/components/ReorderableList/index.js +130 -0
- package/lib/module/components/ReorderableList/index.js.map +1 -0
- package/lib/module/components/ReorderableList/index.web.js +229 -0
- package/lib/module/components/ReorderableList/index.web.js.map +1 -0
- package/lib/module/components/ReorderableList/labels.js +41 -0
- package/lib/module/components/ReorderableList/labels.js.map +1 -0
- package/lib/module/components/ReorderableList/reorderItems.js +12 -0
- package/lib/module/components/ReorderableList/reorderItems.js.map +1 -0
- package/lib/module/components/ReorderableList/rowContext.js +38 -0
- package/lib/module/components/ReorderableList/rowContext.js.map +1 -0
- package/lib/module/components/ReorderableList/types.js +4 -0
- package/lib/module/components/ReorderableList/types.js.map +1 -0
- package/lib/module/components/ReorderableList/useReorder.js +123 -0
- package/lib/module/components/ReorderableList/useReorder.js.map +1 -0
- package/lib/module/components/ReorderableList/webDnd.js +59 -0
- package/lib/module/components/ReorderableList/webDnd.js.map +1 -0
- package/lib/module/components/ScopedTheme/index.js.map +1 -1
- package/lib/module/components/Skeleton/index.js.map +1 -1
- package/lib/module/components/TablePagination/index.js.map +1 -1
- package/lib/module/components/Text/index.js.map +1 -1
- package/lib/module/components/Tile/styles.js +1 -1
- package/lib/module/components/Tile/styles.js.map +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/reorderable-list.js +4 -0
- package/lib/module/reorderable-list.js.map +1 -0
- package/lib/typescript/components/Checkbox/index.d.ts +22 -0
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
- package/lib/typescript/components/Heading/index.d.ts +20 -2
- package/lib/typescript/components/Heading/index.d.ts.map +1 -1
- package/lib/typescript/components/Icon/index.d.ts +2 -0
- package/lib/typescript/components/Icon/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts +23 -1
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts +5 -0
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/components/Menu/index.d.ts +116 -4
- package/lib/typescript/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/components/RangeCalendar/index.d.ts +2 -0
- package/lib/typescript/components/RangeCalendar/index.d.ts.map +1 -1
- package/lib/typescript/components/ReorderableList/ReorderableListShared.d.ts +31 -0
- package/lib/typescript/components/ReorderableList/ReorderableListShared.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/index.d.ts +8 -0
- package/lib/typescript/components/ReorderableList/index.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/index.web.d.ts +8 -0
- package/lib/typescript/components/ReorderableList/index.web.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/labels.d.ts +16 -0
- package/lib/typescript/components/ReorderableList/labels.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/reorderItems.d.ts +3 -0
- package/lib/typescript/components/ReorderableList/reorderItems.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/rowContext.d.ts +57 -0
- package/lib/typescript/components/ReorderableList/rowContext.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/types.d.ts +75 -0
- package/lib/typescript/components/ReorderableList/types.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/useReorder.d.ts +31 -0
- package/lib/typescript/components/ReorderableList/useReorder.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/webDnd.d.ts +27 -0
- package/lib/typescript/components/ReorderableList/webDnd.d.ts.map +1 -0
- package/lib/typescript/components/ScopedTheme/index.d.ts +6 -1
- package/lib/typescript/components/ScopedTheme/index.d.ts.map +1 -1
- package/lib/typescript/components/Skeleton/index.d.ts +3 -0
- package/lib/typescript/components/Skeleton/index.d.ts.map +1 -1
- package/lib/typescript/components/TablePagination/index.d.ts +54 -0
- package/lib/typescript/components/TablePagination/index.d.ts.map +1 -1
- package/lib/typescript/components/Text/index.d.ts +12 -2
- package/lib/typescript/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/components/Tile/styles.d.ts.map +1 -1
- package/lib/typescript/components/ToggleButton/styles.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/reorderable-list.d.ts +2 -0
- package/lib/typescript/reorderable-list.d.ts.map +1 -0
- package/package.json +34 -7
- package/src/components/Checkbox/index.tsx +22 -0
- package/src/components/Heading/index.tsx +10 -1
- package/src/components/Icon/index.tsx +2 -0
- package/src/components/ListItem/index.tsx +227 -11
- package/src/components/ListItem/styles.ts +40 -0
- package/src/components/Menu/index.tsx +117 -4
- package/src/components/RangeCalendar/index.tsx +2 -0
- package/src/components/ReorderableList/ReorderableListShared.tsx +113 -0
- package/src/components/ReorderableList/index.tsx +162 -0
- package/src/components/ReorderableList/index.web.tsx +254 -0
- package/src/components/ReorderableList/labels.ts +52 -0
- package/src/components/ReorderableList/reorderItems.ts +16 -0
- package/src/components/ReorderableList/rowContext.tsx +72 -0
- package/src/components/ReorderableList/types.ts +80 -0
- package/src/components/ReorderableList/useReorder.ts +159 -0
- package/src/components/ReorderableList/webDnd.ts +60 -0
- package/src/components/ScopedTheme/index.tsx +6 -1
- package/src/components/Skeleton/index.tsx +3 -0
- package/src/components/TablePagination/index.tsx +54 -0
- package/src/components/Text/index.tsx +6 -1
- package/src/components/Tile/styles.ts +4 -1
- package/src/components/index.ts +5 -0
- package/src/reorderable-list.ts +1 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, forwardRef, useCallback, useContext, useMemo, useState } from 'react';
|
|
4
|
+
import { AccessibilityInfo } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedReaction, useAnimatedRef } from 'react-native-reanimated';
|
|
6
|
+
import Sortable, { useItemContext } from 'react-native-sortables';
|
|
7
|
+
import { scheduleOnRN } from 'react-native-worklets';
|
|
8
|
+
import { mergeRefs } from '@cdx-ui/utils';
|
|
9
|
+
import { ReorderableListShared } from './ReorderableListShared';
|
|
10
|
+
import { ReorderableRowProvider } from './rowContext';
|
|
11
|
+
import { useReorderableRowValue, useReorderController } from './useReorder';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const nativeHandle = {
|
|
14
|
+
props: {},
|
|
15
|
+
ref: undefined,
|
|
16
|
+
wrap: (host, style) => /*#__PURE__*/_jsx(Sortable.Handle, {
|
|
17
|
+
style: style,
|
|
18
|
+
children: host
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
const AnimatedScrollView = Animated.ScrollView;
|
|
22
|
+
const NativeListContext = /*#__PURE__*/createContext(null);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* sortables keeps rendered rows mounted and only re-renders a row when its item, index, or the
|
|
26
|
+
* grid's `renderItem` identity changes. The grid gets a stable `renderItem`; the consumer's
|
|
27
|
+
* (usually inline) `renderItem` reaches rows through context instead.
|
|
28
|
+
*/
|
|
29
|
+
function NativeRow({
|
|
30
|
+
item,
|
|
31
|
+
index
|
|
32
|
+
}) {
|
|
33
|
+
const list = useContext(NativeListContext);
|
|
34
|
+
const {
|
|
35
|
+
isActive
|
|
36
|
+
} = useItemContext();
|
|
37
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
38
|
+
useAnimatedReaction(() => isActive.get(), (active, previous) => {
|
|
39
|
+
if (active !== (previous ?? false)) scheduleOnRN(setIsDragging, active);
|
|
40
|
+
});
|
|
41
|
+
const rowValue = useReorderableRowValue({
|
|
42
|
+
index,
|
|
43
|
+
count: list.controller.data.length,
|
|
44
|
+
isDragging,
|
|
45
|
+
handle: nativeHandle,
|
|
46
|
+
labels: list.controller.labels,
|
|
47
|
+
moveItem: list.controller.moveItem
|
|
48
|
+
});
|
|
49
|
+
return /*#__PURE__*/_jsx(ReorderableRowProvider, {
|
|
50
|
+
value: rowValue,
|
|
51
|
+
children: list.renderItem({
|
|
52
|
+
item,
|
|
53
|
+
index,
|
|
54
|
+
isDragging
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const renderGridItem = info => /*#__PURE__*/_jsx(NativeRow, {
|
|
59
|
+
...info
|
|
60
|
+
});
|
|
61
|
+
function ReorderableListInner({
|
|
62
|
+
data,
|
|
63
|
+
keyExtractor,
|
|
64
|
+
onReorder,
|
|
65
|
+
onReorderIndices,
|
|
66
|
+
renderItem,
|
|
67
|
+
getItemLabel,
|
|
68
|
+
labels,
|
|
69
|
+
scrollEventThrottle = 16,
|
|
70
|
+
...rest
|
|
71
|
+
}, ref) {
|
|
72
|
+
const scrollableRef = useAnimatedRef();
|
|
73
|
+
const mergedRef = useMemo(() => mergeRefs(ref, scrollableRef), [ref, scrollableRef]);
|
|
74
|
+
const controller = useReorderController({
|
|
75
|
+
data,
|
|
76
|
+
onReorder,
|
|
77
|
+
onReorderIndices,
|
|
78
|
+
getItemLabel,
|
|
79
|
+
labels,
|
|
80
|
+
announce: AccessibilityInfo.announceForAccessibility
|
|
81
|
+
});
|
|
82
|
+
const listValue = useMemo(() => ({
|
|
83
|
+
renderItem,
|
|
84
|
+
controller
|
|
85
|
+
}), [controller, renderItem]);
|
|
86
|
+
const gridKeyExtractor = useMemo(() => {
|
|
87
|
+
const keys = new Map();
|
|
88
|
+
data.forEach((item, index) => keys.set(item, keyExtractor(item, index)));
|
|
89
|
+
return item => keys.get(item) ?? keyExtractor(item, data.indexOf(item));
|
|
90
|
+
}, [data, keyExtractor]);
|
|
91
|
+
const handleDragEnd = useCallback(({
|
|
92
|
+
fromIndex,
|
|
93
|
+
toIndex,
|
|
94
|
+
data: reordered
|
|
95
|
+
}) => {
|
|
96
|
+
if (fromIndex === toIndex) return;
|
|
97
|
+
const message = controller.describe('dropped', fromIndex, toIndex);
|
|
98
|
+
onReorder(reordered);
|
|
99
|
+
onReorderIndices?.(fromIndex, toIndex);
|
|
100
|
+
if (message) AccessibilityInfo.announceForAccessibility(message);
|
|
101
|
+
}, [controller, onReorder, onReorderIndices]);
|
|
102
|
+
return /*#__PURE__*/_jsx(NativeListContext.Provider, {
|
|
103
|
+
value: listValue,
|
|
104
|
+
children: /*#__PURE__*/_jsx(ReorderableListShared, {
|
|
105
|
+
ref: mergedRef,
|
|
106
|
+
ScrollComponent: AnimatedScrollView,
|
|
107
|
+
data: data,
|
|
108
|
+
keyExtractor: keyExtractor,
|
|
109
|
+
scrollEventThrottle: scrollEventThrottle,
|
|
110
|
+
...rest,
|
|
111
|
+
children: /*#__PURE__*/_jsx(Sortable.Grid, {
|
|
112
|
+
columns: 1,
|
|
113
|
+
data: data,
|
|
114
|
+
keyExtractor: gridKeyExtractor,
|
|
115
|
+
renderItem: renderGridItem,
|
|
116
|
+
scrollableRef: scrollableRef,
|
|
117
|
+
customHandle: true,
|
|
118
|
+
dragActivationDelay: 0,
|
|
119
|
+
overDrag: "vertical",
|
|
120
|
+
activeItemScale: 1,
|
|
121
|
+
inactiveItemOpacity: 1,
|
|
122
|
+
activeItemShadowOpacity: 0,
|
|
123
|
+
onDragEnd: handleDragEnd
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export const ReorderableList = /*#__PURE__*/forwardRef(ReorderableListInner);
|
|
129
|
+
ReorderableList.displayName = 'ReorderableList';
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","forwardRef","useCallback","useContext","useMemo","useState","AccessibilityInfo","Animated","useAnimatedReaction","useAnimatedRef","Sortable","useItemContext","scheduleOnRN","mergeRefs","ReorderableListShared","ReorderableRowProvider","useReorderableRowValue","useReorderController","jsx","_jsx","nativeHandle","props","ref","undefined","wrap","host","style","Handle","children","AnimatedScrollView","ScrollView","NativeListContext","NativeRow","item","index","list","isActive","isDragging","setIsDragging","get","active","previous","rowValue","count","controller","data","length","handle","labels","moveItem","value","renderItem","renderGridItem","info","ReorderableListInner","keyExtractor","onReorder","onReorderIndices","getItemLabel","scrollEventThrottle","rest","scrollableRef","mergedRef","announce","announceForAccessibility","listValue","gridKeyExtractor","keys","Map","forEach","set","indexOf","handleDragEnd","fromIndex","toIndex","reordered","message","describe","Provider","ScrollComponent","Grid","columns","customHandle","dragActivationDelay","overDrag","activeItemScale","inactiveItemOpacity","activeItemShadowOpacity","onDragEnd","ReorderableList","displayName"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/index.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QAGH,OAAO;AACd,SAASC,iBAAiB,QAAoB,cAAc;AAC5D,OAAOC,QAAQ,IAAIC,mBAAmB,EAAEC,cAAc,QAAQ,yBAAyB;AACvF,OAAOC,QAAQ,IACbC,cAAc,QAGT,wBAAwB;AAC/B,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,sBAAsB,QAAmC,cAAc;AAEhF,SAASC,sBAAsB,EAAEC,oBAAoB,QAAgC,cAAc;AAAC,SAAAC,GAAA,IAAA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EjC;AAEA,OAAO,MAAMiB,eAAe,gBAAGxF,UAAU,CAACqD,oBAAoB,CAEtC;AAEvBmC,eAAe,CAA8BC,WAAW,GAAG,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { Text, View } from 'react-native';
|
|
5
|
+
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useDndContext, useSensor, useSensors } from '@dnd-kit/core';
|
|
6
|
+
import { SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
7
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
8
|
+
import { cn } from '@cdx-ui/utils';
|
|
9
|
+
import { ReorderableListShared } from './ReorderableListShared';
|
|
10
|
+
import { reorderItems } from './reorderItems';
|
|
11
|
+
import { ReorderableRowProvider } from './rowContext';
|
|
12
|
+
import { useReorderableRowValue, useReorderController } from './useReorder';
|
|
13
|
+
import { createReorderAnnouncements, resolveDragEnd } from './webDnd';
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const handleTouchStyle = {
|
|
16
|
+
touchAction: 'none'
|
|
17
|
+
};
|
|
18
|
+
const passThrough = host => host;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* react-native-web's `Pressable` stops Enter/Space `keydown` from bubbling, so when the handle is a
|
|
22
|
+
* pressable control (`asChild` with an `IconButton`) the drop key never reaches dnd-kit's document
|
|
23
|
+
* listener. While dragging, take the key at the handle and hand it to the document directly.
|
|
24
|
+
*/
|
|
25
|
+
function forwardDropKeyToDocument(event) {
|
|
26
|
+
const {
|
|
27
|
+
key,
|
|
28
|
+
code
|
|
29
|
+
} = event.nativeEvent;
|
|
30
|
+
if (key !== 'Enter' && key !== ' ' && code !== 'Enter' && code !== 'Space') return;
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
const {
|
|
34
|
+
ownerDocument
|
|
35
|
+
} = event.currentTarget;
|
|
36
|
+
ownerDocument?.dispatchEvent(new KeyboardEvent('keydown', {
|
|
37
|
+
key,
|
|
38
|
+
code,
|
|
39
|
+
cancelable: true
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
function SortableRow({
|
|
43
|
+
info,
|
|
44
|
+
renderItem,
|
|
45
|
+
controller
|
|
46
|
+
}) {
|
|
47
|
+
const {
|
|
48
|
+
item,
|
|
49
|
+
index,
|
|
50
|
+
count,
|
|
51
|
+
key
|
|
52
|
+
} = info;
|
|
53
|
+
const {
|
|
54
|
+
attributes,
|
|
55
|
+
listeners,
|
|
56
|
+
setNodeRef,
|
|
57
|
+
setActivatorNodeRef,
|
|
58
|
+
transform,
|
|
59
|
+
transition,
|
|
60
|
+
isDragging
|
|
61
|
+
} = useSortable({
|
|
62
|
+
id: key
|
|
63
|
+
});
|
|
64
|
+
const {
|
|
65
|
+
activatorEvent
|
|
66
|
+
} = useDndContext();
|
|
67
|
+
const nodeRef = useRef(null);
|
|
68
|
+
const swallowNextClickRef = useRef(false);
|
|
69
|
+
const setRowRef = useCallback(node => {
|
|
70
|
+
const element = node;
|
|
71
|
+
nodeRef.current = element;
|
|
72
|
+
setNodeRef(element);
|
|
73
|
+
}, [setNodeRef]);
|
|
74
|
+
|
|
75
|
+
// dnd-kit's shift/drop animation is written to the row's DOM node; React never owns these keys.
|
|
76
|
+
useLayoutEffect(() => {
|
|
77
|
+
const node = nodeRef.current;
|
|
78
|
+
if (!node) return;
|
|
79
|
+
node.style.transform = transform ? CSS.Translate.toString({
|
|
80
|
+
...transform,
|
|
81
|
+
x: 0
|
|
82
|
+
}) ?? '' : '';
|
|
83
|
+
node.style.transition = transition ?? '';
|
|
84
|
+
}, [transform, transition]);
|
|
85
|
+
|
|
86
|
+
// A pointer drag ends with a click on the row; swallow that one click so a pressable row does
|
|
87
|
+
// not fire after a drop or cancel. Scoped to this row, and reset by the next pointerdown.
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (isDragging && activatorEvent?.type.startsWith('pointer')) {
|
|
90
|
+
swallowNextClickRef.current = true;
|
|
91
|
+
}
|
|
92
|
+
}, [activatorEvent, isDragging]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const node = nodeRef.current;
|
|
95
|
+
if (!node) return undefined;
|
|
96
|
+
const onClick = event => {
|
|
97
|
+
if (!swallowNextClickRef.current) return;
|
|
98
|
+
swallowNextClickRef.current = false;
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
};
|
|
102
|
+
const onPointerDown = () => {
|
|
103
|
+
swallowNextClickRef.current = false;
|
|
104
|
+
};
|
|
105
|
+
node.addEventListener('click', onClick, true);
|
|
106
|
+
node.addEventListener('pointerdown', onPointerDown, true);
|
|
107
|
+
return () => {
|
|
108
|
+
node.removeEventListener('click', onClick, true);
|
|
109
|
+
node.removeEventListener('pointerdown', onPointerDown, true);
|
|
110
|
+
};
|
|
111
|
+
}, []);
|
|
112
|
+
const handle = useMemo(() => {
|
|
113
|
+
const {
|
|
114
|
+
tabIndex,
|
|
115
|
+
role,
|
|
116
|
+
...aria
|
|
117
|
+
} = attributes;
|
|
118
|
+
return {
|
|
119
|
+
props: {
|
|
120
|
+
...aria,
|
|
121
|
+
role: role,
|
|
122
|
+
tabIndex: tabIndex === 0 || tabIndex === -1 ? tabIndex : undefined,
|
|
123
|
+
style: handleTouchStyle,
|
|
124
|
+
...listeners,
|
|
125
|
+
onKeyDownCapture: isDragging ? forwardDropKeyToDocument : undefined
|
|
126
|
+
},
|
|
127
|
+
ref: node => setActivatorNodeRef(node),
|
|
128
|
+
wrap: passThrough
|
|
129
|
+
};
|
|
130
|
+
}, [attributes, isDragging, listeners, setActivatorNodeRef]);
|
|
131
|
+
const rowValue = useReorderableRowValue({
|
|
132
|
+
index,
|
|
133
|
+
count,
|
|
134
|
+
isDragging,
|
|
135
|
+
handle,
|
|
136
|
+
labels: controller.labels,
|
|
137
|
+
moveItem: controller.moveItem
|
|
138
|
+
});
|
|
139
|
+
return /*#__PURE__*/_jsx(ReorderableRowProvider, {
|
|
140
|
+
value: rowValue,
|
|
141
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
142
|
+
ref: setRowRef,
|
|
143
|
+
className: cn(isDragging && 'relative z-20'),
|
|
144
|
+
children: renderItem({
|
|
145
|
+
item,
|
|
146
|
+
index,
|
|
147
|
+
isDragging
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function ReorderableListInner({
|
|
153
|
+
data,
|
|
154
|
+
keyExtractor,
|
|
155
|
+
renderItem,
|
|
156
|
+
onReorder,
|
|
157
|
+
onReorderIndices,
|
|
158
|
+
getItemLabel,
|
|
159
|
+
labels,
|
|
160
|
+
...rest
|
|
161
|
+
}, ref) {
|
|
162
|
+
const [announcement, setAnnouncement] = useState('');
|
|
163
|
+
const controller = useReorderController({
|
|
164
|
+
data,
|
|
165
|
+
onReorder,
|
|
166
|
+
onReorderIndices,
|
|
167
|
+
getItemLabel,
|
|
168
|
+
labels,
|
|
169
|
+
announce: setAnnouncement
|
|
170
|
+
});
|
|
171
|
+
const sortableIds = useMemo(() => data.map((item, index) => keyExtractor(item, index)), [data, keyExtractor]);
|
|
172
|
+
const sensors = useSensors(useSensor(PointerSensor, {
|
|
173
|
+
activationConstraint: {
|
|
174
|
+
distance: 4
|
|
175
|
+
}
|
|
176
|
+
}), useSensor(KeyboardSensor, {
|
|
177
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
178
|
+
}));
|
|
179
|
+
const {
|
|
180
|
+
describe,
|
|
181
|
+
labels: resolvedLabels
|
|
182
|
+
} = controller;
|
|
183
|
+
const accessibility = useMemo(() => ({
|
|
184
|
+
announcements: createReorderAnnouncements(sortableIds, describe),
|
|
185
|
+
screenReaderInstructions: {
|
|
186
|
+
draggable: resolvedLabels.screenReaderInstructions
|
|
187
|
+
}
|
|
188
|
+
}), [describe, resolvedLabels, sortableIds]);
|
|
189
|
+
const handleDragEnd = useCallback(({
|
|
190
|
+
active,
|
|
191
|
+
over
|
|
192
|
+
}) => {
|
|
193
|
+
const move = resolveDragEnd(sortableIds, active.id, over?.id);
|
|
194
|
+
if (!move) return;
|
|
195
|
+
onReorder(reorderItems(data, move.from, move.to));
|
|
196
|
+
onReorderIndices?.(move.from, move.to);
|
|
197
|
+
}, [data, onReorder, onReorderIndices, sortableIds]);
|
|
198
|
+
const renderRow = useCallback(info => /*#__PURE__*/_jsx(SortableRow, {
|
|
199
|
+
info: info,
|
|
200
|
+
renderItem: renderItem,
|
|
201
|
+
controller: controller
|
|
202
|
+
}), [controller, renderItem]);
|
|
203
|
+
return /*#__PURE__*/_jsxs(DndContext, {
|
|
204
|
+
accessibility: accessibility,
|
|
205
|
+
collisionDetection: closestCenter,
|
|
206
|
+
onDragEnd: handleDragEnd,
|
|
207
|
+
sensors: sensors,
|
|
208
|
+
children: [/*#__PURE__*/_jsx(SortableContext, {
|
|
209
|
+
items: sortableIds,
|
|
210
|
+
strategy: verticalListSortingStrategy,
|
|
211
|
+
children: /*#__PURE__*/_jsx(ReorderableListShared, {
|
|
212
|
+
ref: ref,
|
|
213
|
+
data: data,
|
|
214
|
+
keyExtractor: keyExtractor,
|
|
215
|
+
renderRow: renderRow,
|
|
216
|
+
...rest
|
|
217
|
+
})
|
|
218
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
219
|
+
"aria-live": "polite",
|
|
220
|
+
className: "sr-only",
|
|
221
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
222
|
+
children: announcement
|
|
223
|
+
})
|
|
224
|
+
})]
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
export const ReorderableList = /*#__PURE__*/forwardRef(ReorderableListInner);
|
|
228
|
+
ReorderableList.displayName = 'ReorderableList';
|
|
229
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","Text","View","DndContext","KeyboardSensor","PointerSensor","closestCenter","useDndContext","useSensor","useSensors","SortableContext","sortableKeyboardCoordinates","useSortable","verticalListSortingStrategy","CSS","cn","ReorderableListShared","reorderItems","ReorderableRowProvider","useReorderableRowValue","useReorderController","createReorderAnnouncements","resolveDragEnd","jsx","_jsx","jsxs","_jsxs","handleTouchStyle","touchAction","passThrough","host","forwardDropKeyToDocument","event","key","code","nativeEvent","preventDefault","stopPropagation","ownerDocument","currentTarget","dispatchEvent","KeyboardEvent","cancelable","SortableRow","info","renderItem","controller","item","index","count","attributes","listeners","setNodeRef","setActivatorNodeRef","transform","transition","isDragging","id","activatorEvent","nodeRef","swallowNextClickRef","setRowRef","node","element","current","style","Translate","toString","x","type","startsWith","undefined","onClick","onPointerDown","addEventListener","removeEventListener","handle","tabIndex","role","aria","props","onKeyDownCapture","ref","wrap","rowValue","labels","moveItem","value","children","className","ReorderableListInner","data","keyExtractor","onReorder","onReorderIndices","getItemLabel","rest","announcement","setAnnouncement","announce","sortableIds","map","sensors","activationConstraint","distance","coordinateGetter","describe","resolvedLabels","accessibility","announcements","screenReaderInstructions","draggable","handleDragEnd","active","over","move","from","to","renderRow","collisionDetection","onDragEnd","items","strategy","ReorderableList","displayName"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/index.web.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAIH,OAAO;AACd,SAAqBC,IAAI,EAAEC,IAAI,QAAwC,cAAc;AACrF,SACEC,UAAU,EACVC,cAAc,EACdC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,SAAS,EACTC,UAAU,QAEL,eAAe;AACtB,SACEC,eAAe,EACfC,2BAA2B,EAC3BC,WAAW,EACXC,2BAA2B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AAA,gBAEjBhE,IAAA,CAACd,eAAe;MAAC+G,KAAK,EAAErB,WAAY;MAACsB,QAAQ,EAAE7G,2BAA4B;MAAA2E,QAAA,eACzEhE,IAAA,CAACR,qBAAqB;QACpBkE,GAAG,EAAEA,GAAI;QACTS,IAAI,EAAEA,IAAK;QACXC,YAAY,EAAEA,YAAa;QAC3B0B,SAAS,EAAEA,SAAU;QAAA,GACjBtB;MAAI,CACT;IAAC,CACa,CAAC,eAClBxE,IAAA,CAACtB,IAAI;MAAC,aAAU,QAAQ;MAACuF,SAAS,EAAC,SAAS;MAAAD,QAAA,eAC1ChE,IAAA,CAACvB,IAAI;QAAAuF,QAAA,EAAES;MAAY,CAAO;IAAC,CACvB,CAAC;EAAA,CACG,CAAC;AAEjB;AAEA,OAAO,MAAM0B,eAAe,gBAAGjI,UAAU,CAACgG,oBAAoB,CAEtC;AAEvBiC,eAAe,CAA8BC,WAAW,GAAG,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_REORDERABLE_LIST_LABELS = {
|
|
4
|
+
item: 'item {position}',
|
|
5
|
+
pickedUp: 'Picked up {item}. Position {position} of {count}.',
|
|
6
|
+
movedTo: 'Moved {item} to position {position} of {count}.',
|
|
7
|
+
dropped: 'Dropped {item} at position {position} of {count}.',
|
|
8
|
+
cancelled: 'Reorder cancelled. {item} returned to position {position} of {count}.',
|
|
9
|
+
screenReaderInstructions: 'To pick up an item, press Space or Enter. Use the arrow keys to move it, then press Space or Enter to drop it, or Escape to cancel.',
|
|
10
|
+
moveUp: 'Move up',
|
|
11
|
+
moveDown: 'Move down',
|
|
12
|
+
moveToTop: 'Move to top',
|
|
13
|
+
moveToBottom: 'Move to bottom'
|
|
14
|
+
};
|
|
15
|
+
export function resolveReorderableListLabels(partial) {
|
|
16
|
+
return {
|
|
17
|
+
...DEFAULT_REORDERABLE_LIST_LABELS,
|
|
18
|
+
...partial
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function fill(template, values) {
|
|
22
|
+
return template.replace(/\{(\w+)\}/g, (match, name) => values[name] ?? match);
|
|
23
|
+
}
|
|
24
|
+
export function formatReorderMessage(key, {
|
|
25
|
+
labels,
|
|
26
|
+
getItemLabel,
|
|
27
|
+
item,
|
|
28
|
+
fromIndex,
|
|
29
|
+
position,
|
|
30
|
+
count
|
|
31
|
+
}) {
|
|
32
|
+
const itemName = getItemLabel ? getItemLabel(item, fromIndex) : fill(labels.item, {
|
|
33
|
+
position: String(fromIndex + 1)
|
|
34
|
+
});
|
|
35
|
+
return fill(labels[key], {
|
|
36
|
+
item: itemName,
|
|
37
|
+
position: String(position + 1),
|
|
38
|
+
count: String(count)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_REORDERABLE_LIST_LABELS","item","pickedUp","movedTo","dropped","cancelled","screenReaderInstructions","moveUp","moveDown","moveToTop","moveToBottom","resolveReorderableListLabels","partial","fill","template","values","replace","match","name","formatReorderMessage","key","labels","getItemLabel","fromIndex","position","count","itemName","String"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/labels.ts"],"mappings":";;AAEA,OAAO,MAAMA,+BAAsD,GAAG;EACpEC,IAAI,EAAE,iBAAiB;EACvBC,QAAQ,EAAE,mDAAmD;EAC7DC,OAAO,EAAE,iDAAiD;EAC1DC,OAAO,EAAE,mDAAmD;EAC5DC,SAAS,EAAE,uEAAuE;EAClFC,wBAAwB,EACtB,qIAAqI;EACvIC,MAAM,EAAE,SAAS;EACjBC,QAAQ,EAAE,WAAW;EACrBC,SAAS,EAAE,aAAa;EACxBC,YAAY,EAAE;AAChB,CAAC;AAED,OAAO,SAASC,4BAA4BA,CAC1CC,OAAwC,EACjB;EACvB,OAAO;IAAE,GAAGZ,+BAA+B;IAAE,GAAGY;EAAQ,CAAC;AAC3D;AAeA,SAASC,IAAIA,CAACC,QAAgB,EAAEC,MAA8B,EAAU;EACtE,OAAOD,QAAQ,CAACE,OAAO,CAAC,YAAY,EAAE,CAACC,KAAK,EAAEC,IAAY,KAAKH,MAAM,CAACG,IAAI,CAAC,IAAID,KAAK,CAAC;AACvF;AAEA,OAAO,SAASE,oBAAoBA,CAClCC,GAAsB,EACtB;EAAEC,MAAM;EAAEC,YAAY;EAAErB,IAAI;EAAEsB,SAAS;EAAEC,QAAQ;EAAEC;AAA8B,CAAC,EAC1E;EACR,MAAMC,QAAQ,GAAGJ,YAAY,GACzBA,YAAY,CAACrB,IAAI,EAAEsB,SAAS,CAAC,GAC7BV,IAAI,CAACQ,MAAM,CAACpB,IAAI,EAAE;IAAEuB,QAAQ,EAAEG,MAAM,CAACJ,SAAS,GAAG,CAAC;EAAE,CAAC,CAAC;EAC1D,OAAOV,IAAI,CAACQ,MAAM,CAACD,GAAG,CAAC,EAAE;IACvBnB,IAAI,EAAEyB,QAAQ;IACdF,QAAQ,EAAEG,MAAM,CAACH,QAAQ,GAAG,CAAC,CAAC;IAC9BC,KAAK,EAAEE,MAAM,CAACF,KAAK;EACrB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** Immutable insert-strategy move. No-ops when indices are equal or out of range. */
|
|
4
|
+
export function reorderItems(data, fromIndex, toIndex) {
|
|
5
|
+
if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= data.length || toIndex >= data.length) {
|
|
6
|
+
return data;
|
|
7
|
+
}
|
|
8
|
+
const next = data.slice();
|
|
9
|
+
next.splice(toIndex, 0, ...next.splice(fromIndex, 1));
|
|
10
|
+
return next;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=reorderItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["reorderItems","data","fromIndex","toIndex","length","next","slice","splice"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/reorderItems.ts"],"mappings":";;AAAA;AACA,OAAO,SAASA,YAAYA,CAAIC,IAAS,EAAEC,SAAiB,EAAEC,OAAe,EAAO;EAClF,IACED,SAAS,KAAKC,OAAO,IACrBD,SAAS,GAAG,CAAC,IACbC,OAAO,GAAG,CAAC,IACXD,SAAS,IAAID,IAAI,CAACG,MAAM,IACxBD,OAAO,IAAIF,IAAI,CAACG,MAAM,EACtB;IACA,OAAOH,IAAI;EACb;EAEA,MAAMI,IAAI,GAAGJ,IAAI,CAACK,KAAK,CAAC,CAAC;EACzBD,IAAI,CAACE,MAAM,CAACJ,OAAO,EAAE,CAAC,EAAE,GAAGE,IAAI,CAACE,MAAM,CAACL,SAAS,EAAE,CAAC,CAAC,CAAC;EACrD,OAAOG,IAAI;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props that make a host element the row's drag activator.
|
|
7
|
+
*
|
|
8
|
+
* - **Web:** dnd-kit `attributes` (`role`, `tabIndex`, `aria-*`), `listeners` (`onPointerDown`,
|
|
9
|
+
* `onKeyDown`), and `style: { touchAction: 'none' }`. Some keys (`aria-roledescription`,
|
|
10
|
+
* `aria-describedby`) are outside `ViewProps`, hence the index signature.
|
|
11
|
+
* - **Native:** empty — the gesture is attached by `wrap`.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Binds a handle element to the row's drag gesture without adding a focusable wrapper.
|
|
16
|
+
*
|
|
17
|
+
* Render one host (a `View`, or the consumer child under `asChild` via `Slot`), then:
|
|
18
|
+
* 1. spread `props` onto it before consumer props (handlers compose through `Slot`),
|
|
19
|
+
* 2. compose `ref` with the host's own ref,
|
|
20
|
+
* 3. return `wrap(host)`.
|
|
21
|
+
*
|
|
22
|
+
* Web: `ref` is dnd-kit's `setActivatorNodeRef` and `wrap` returns the host unchanged.
|
|
23
|
+
* Native: `ref` is `undefined` and `wrap` places the host inside `Sortable.Handle`, which must
|
|
24
|
+
* wrap because react-native-sortables only attaches its handle gesture through that component. It
|
|
25
|
+
* renders a non-accessible `View`, so the host stays the single focusable element; pass layout
|
|
26
|
+
* styles that must sit on the outer box (flex, alignSelf, margin) as `wrap`'s second argument.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** Per-row reorder state and actions, provided to every row rendered by `ReorderableList`. */
|
|
30
|
+
|
|
31
|
+
const ReorderableRowContext = /*#__PURE__*/createContext(null);
|
|
32
|
+
export const ReorderableRowProvider = ReorderableRowContext.Provider;
|
|
33
|
+
|
|
34
|
+
/** Reorder state for the enclosing `ReorderableList` row, or `null` outside a list. */
|
|
35
|
+
export function useReorderableRow() {
|
|
36
|
+
return useContext(ReorderableRowContext);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=rowContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","ReorderableRowContext","ReorderableRowProvider","Provider","useReorderableRow"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/rowContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAA6C,OAAO;;AAUtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;;AAwBA,MAAMC,qBAAqB,gBAAGF,aAAa,CAAoC,IAAI,CAAC;AAEpF,OAAO,MAAMG,sBAAsB,GAAGD,qBAAqB,CAACE,QAAQ;;AAEpE;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAsC;EACrE,OAAOJ,UAAU,CAACC,qBAAqB,CAAC;AAC1C","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/ReorderableList/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
|
+
import { formatReorderMessage, resolveReorderableListLabels } from './labels';
|
|
5
|
+
import { reorderItems } from './reorderItems';
|
|
6
|
+
export function buildReorderAccessibilityActions(index, count, labels) {
|
|
7
|
+
const actions = [];
|
|
8
|
+
if (index > 0) {
|
|
9
|
+
actions.push({
|
|
10
|
+
name: 'moveUp',
|
|
11
|
+
label: labels.moveUp
|
|
12
|
+
});
|
|
13
|
+
if (index > 1) actions.push({
|
|
14
|
+
name: 'moveToTop',
|
|
15
|
+
label: labels.moveToTop
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (index < count - 1) {
|
|
19
|
+
actions.push({
|
|
20
|
+
name: 'moveDown',
|
|
21
|
+
label: labels.moveDown
|
|
22
|
+
});
|
|
23
|
+
if (index < count - 2) actions.push({
|
|
24
|
+
name: 'moveToBottom',
|
|
25
|
+
label: labels.moveToBottom
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return actions;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Target index for a reorder accessibility action, or `undefined` for other actions. */
|
|
32
|
+
export function getReorderActionTarget(actionName, index, count) {
|
|
33
|
+
switch (actionName) {
|
|
34
|
+
case 'moveUp':
|
|
35
|
+
return index - 1;
|
|
36
|
+
case 'moveDown':
|
|
37
|
+
return index + 1;
|
|
38
|
+
case 'moveToTop':
|
|
39
|
+
return 0;
|
|
40
|
+
case 'moveToBottom':
|
|
41
|
+
return count - 1;
|
|
42
|
+
default:
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Duplicate keys in `data`, for the development warning. */
|
|
48
|
+
export function findDuplicateKeys(data, keyExtractor) {
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
const duplicates = new Set();
|
|
51
|
+
data.forEach((item, index) => {
|
|
52
|
+
const key = keyExtractor(item, index);
|
|
53
|
+
if (seen.has(key)) duplicates.add(key);
|
|
54
|
+
seen.add(key);
|
|
55
|
+
});
|
|
56
|
+
return [...duplicates];
|
|
57
|
+
}
|
|
58
|
+
export function useReorderController({
|
|
59
|
+
data,
|
|
60
|
+
onReorder,
|
|
61
|
+
onReorderIndices,
|
|
62
|
+
getItemLabel,
|
|
63
|
+
labels: labelsProp,
|
|
64
|
+
announce
|
|
65
|
+
}) {
|
|
66
|
+
const labels = useMemo(() => resolveReorderableListLabels(labelsProp), [labelsProp]);
|
|
67
|
+
const describe = useCallback((key, fromIndex, position) => {
|
|
68
|
+
const item = data[fromIndex];
|
|
69
|
+
if (item === undefined) return undefined;
|
|
70
|
+
return formatReorderMessage(key, {
|
|
71
|
+
labels,
|
|
72
|
+
getItemLabel,
|
|
73
|
+
item,
|
|
74
|
+
fromIndex,
|
|
75
|
+
position,
|
|
76
|
+
count: data.length
|
|
77
|
+
});
|
|
78
|
+
}, [data, getItemLabel, labels]);
|
|
79
|
+
const moveItem = useCallback((fromIndex, toIndex) => {
|
|
80
|
+
if (fromIndex < 0 || fromIndex >= data.length) return;
|
|
81
|
+
const target = Math.min(Math.max(toIndex, 0), data.length - 1);
|
|
82
|
+
if (target === fromIndex) return;
|
|
83
|
+
const message = describe('movedTo', fromIndex, target);
|
|
84
|
+
onReorder(reorderItems(data, fromIndex, target));
|
|
85
|
+
onReorderIndices?.(fromIndex, target);
|
|
86
|
+
if (message) announce(message);
|
|
87
|
+
}, [announce, data, describe, onReorder, onReorderIndices]);
|
|
88
|
+
|
|
89
|
+
// Stable identity: web's accessibility memo keys off this object. A fresh return every render
|
|
90
|
+
// rebuilds createReorderAnnouncements and clears lastAnnouncedIndex, so pick-up is replaced by
|
|
91
|
+
// "moved to" the current position.
|
|
92
|
+
return useMemo(() => ({
|
|
93
|
+
labels,
|
|
94
|
+
moveItem,
|
|
95
|
+
describe,
|
|
96
|
+
data
|
|
97
|
+
}), [labels, moveItem, describe, data]);
|
|
98
|
+
}
|
|
99
|
+
export function useReorderableRowValue({
|
|
100
|
+
index,
|
|
101
|
+
count,
|
|
102
|
+
isDragging,
|
|
103
|
+
handle,
|
|
104
|
+
labels,
|
|
105
|
+
moveItem
|
|
106
|
+
}) {
|
|
107
|
+
return useMemo(() => {
|
|
108
|
+
const move = toIndex => moveItem(index, toIndex);
|
|
109
|
+
return {
|
|
110
|
+
isDragging,
|
|
111
|
+
index,
|
|
112
|
+
count,
|
|
113
|
+
move,
|
|
114
|
+
accessibilityActions: buildReorderAccessibilityActions(index, count, labels),
|
|
115
|
+
onAccessibilityAction: event => {
|
|
116
|
+
const target = getReorderActionTarget(event.nativeEvent.actionName, index, count);
|
|
117
|
+
if (target !== undefined) move(target);
|
|
118
|
+
},
|
|
119
|
+
handle
|
|
120
|
+
};
|
|
121
|
+
}, [count, handle, index, isDragging, labels, moveItem]);
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=useReorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","formatReorderMessage","resolveReorderableListLabels","reorderItems","buildReorderAccessibilityActions","index","count","labels","actions","push","name","label","moveUp","moveToTop","moveDown","moveToBottom","getReorderActionTarget","actionName","undefined","findDuplicateKeys","data","keyExtractor","seen","Set","duplicates","forEach","item","key","has","add","useReorderController","onReorder","onReorderIndices","getItemLabel","labelsProp","announce","describe","fromIndex","position","length","moveItem","toIndex","target","Math","min","max","message","useReorderableRowValue","isDragging","handle","move","accessibilityActions","onAccessibilityAction","event","nativeEvent"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/useReorder.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAE5C,SAASC,oBAAoB,EAAEC,4BAA4B,QAAQ,UAAU;AAC7E,SAASC,YAAY,QAAQ,gBAAgB;AAM7C,OAAO,SAASC,gCAAgCA,CAC9CC,KAAa,EACbC,KAAa,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