@contember/react-repeater-dnd-kit 2.1.0-alpha.30 → 2.1.0-alpha.36
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/package.json +13 -13
- package/src/components/RepeaterSortable.tsx +14 -2
- package/src/components/RepeaterSortableEachItem.tsx +0 -1
- package/src/contexts.ts +1 -1
- package/src/index.ts +0 -1
- package/dist/development/index.cjs +0 -27
- package/dist/development/index.cjs.map +0 -1
- package/dist/development/index.js +0 -21
- package/dist/development/index.js.map +0 -1
- package/dist/development/src/components/RepeaterSortable.cjs +0 -77
- package/dist/development/src/components/RepeaterSortable.cjs.map +0 -1
- package/dist/development/src/components/RepeaterSortable.js +0 -77
- package/dist/development/src/components/RepeaterSortable.js.map +0 -1
- package/dist/development/src/components/RepeaterSortableDragOverlay.cjs +0 -38
- package/dist/development/src/components/RepeaterSortableDragOverlay.cjs.map +0 -1
- package/dist/development/src/components/RepeaterSortableDragOverlay.js +0 -38
- package/dist/development/src/components/RepeaterSortableDragOverlay.js.map +0 -1
- package/dist/development/src/components/RepeaterSortableDropIndicator.cjs +0 -18
- package/dist/development/src/components/RepeaterSortableDropIndicator.cjs.map +0 -1
- package/dist/development/src/components/RepeaterSortableDropIndicator.js +0 -18
- package/dist/development/src/components/RepeaterSortableDropIndicator.js.map +0 -1
- package/dist/development/src/components/RepeaterSortableEachItem.cjs +0 -36
- package/dist/development/src/components/RepeaterSortableEachItem.cjs.map +0 -1
- package/dist/development/src/components/RepeaterSortableEachItem.js +0 -36
- package/dist/development/src/components/RepeaterSortableEachItem.js.map +0 -1
- package/dist/development/src/components/RepeaterSortableItemActivator.cjs +0 -17
- package/dist/development/src/components/RepeaterSortableItemActivator.cjs.map +0 -1
- package/dist/development/src/components/RepeaterSortableItemActivator.js +0 -17
- package/dist/development/src/components/RepeaterSortableItemActivator.js.map +0 -1
- package/dist/development/src/components/RepeaterSortableItemNode.cjs +0 -15
- package/dist/development/src/components/RepeaterSortableItemNode.cjs.map +0 -1
- package/dist/development/src/components/RepeaterSortableItemNode.js +0 -15
- package/dist/development/src/components/RepeaterSortableItemNode.js.map +0 -1
- package/dist/development/src/contexts.cjs +0 -14
- package/dist/development/src/contexts.cjs.map +0 -1
- package/dist/development/src/contexts.js +0 -14
- package/dist/development/src/contexts.js.map +0 -1
- package/dist/production/index.cjs +0 -27
- package/dist/production/index.cjs.map +0 -1
- package/dist/production/index.js +0 -21
- package/dist/production/index.js.map +0 -1
- package/dist/production/src/components/RepeaterSortable.cjs +0 -61
- package/dist/production/src/components/RepeaterSortable.cjs.map +0 -1
- package/dist/production/src/components/RepeaterSortable.js +0 -61
- package/dist/production/src/components/RepeaterSortable.js.map +0 -1
- package/dist/production/src/components/RepeaterSortableDragOverlay.cjs +0 -18
- package/dist/production/src/components/RepeaterSortableDragOverlay.cjs.map +0 -1
- package/dist/production/src/components/RepeaterSortableDragOverlay.js +0 -18
- package/dist/production/src/components/RepeaterSortableDragOverlay.js.map +0 -1
- package/dist/production/src/components/RepeaterSortableDropIndicator.cjs +0 -14
- package/dist/production/src/components/RepeaterSortableDropIndicator.cjs.map +0 -1
- package/dist/production/src/components/RepeaterSortableDropIndicator.js +0 -14
- package/dist/production/src/components/RepeaterSortableDropIndicator.js.map +0 -1
- package/dist/production/src/components/RepeaterSortableEachItem.cjs +0 -20
- package/dist/production/src/components/RepeaterSortableEachItem.cjs.map +0 -1
- package/dist/production/src/components/RepeaterSortableEachItem.js +0 -20
- package/dist/production/src/components/RepeaterSortableEachItem.js.map +0 -1
- package/dist/production/src/components/RepeaterSortableItemActivator.cjs +0 -13
- package/dist/production/src/components/RepeaterSortableItemActivator.cjs.map +0 -1
- package/dist/production/src/components/RepeaterSortableItemActivator.js +0 -13
- package/dist/production/src/components/RepeaterSortableItemActivator.js.map +0 -1
- package/dist/production/src/components/RepeaterSortableItemNode.cjs +0 -11
- package/dist/production/src/components/RepeaterSortableItemNode.cjs.map +0 -1
- package/dist/production/src/components/RepeaterSortableItemNode.js +0 -11
- package/dist/production/src/components/RepeaterSortableItemNode.js.map +0 -1
- package/dist/production/src/contexts.cjs +0 -14
- package/dist/production/src/contexts.cjs.map +0 -1
- package/dist/production/src/contexts.js +0 -14
- package/dist/production/src/contexts.js.map +0 -1
- package/dist/types/components/RepeaterSortable.d.ts +0 -37
- package/dist/types/components/RepeaterSortable.d.ts.map +0 -1
- package/dist/types/components/RepeaterSortableDragOverlay.d.ts +0 -8
- package/dist/types/components/RepeaterSortableDragOverlay.d.ts.map +0 -1
- package/dist/types/components/RepeaterSortableDropIndicator.d.ts +0 -9
- package/dist/types/components/RepeaterSortableDropIndicator.d.ts.map +0 -1
- package/dist/types/components/RepeaterSortableEachItem.d.ts +0 -9
- package/dist/types/components/RepeaterSortableEachItem.d.ts.map +0 -1
- package/dist/types/components/RepeaterSortableItemActivator.d.ts +0 -8
- package/dist/types/components/RepeaterSortableItemActivator.d.ts.map +0 -1
- package/dist/types/components/RepeaterSortableItemNode.d.ts +0 -8
- package/dist/types/components/RepeaterSortableItemNode.d.ts.map +0 -1
- package/dist/types/components/index.d.ts +0 -7
- package/dist/types/components/index.d.ts.map +0 -1
- package/dist/types/contexts.d.ts +0 -62
- package/dist/types/contexts.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/react-repeater-dnd-kit",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.1.0-alpha.
|
|
4
|
+
"version": "2.1.0-alpha.36",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/production/index.js",
|
|
@@ -29,25 +29,25 @@
|
|
|
29
29
|
"ae:test": "api-extractor run"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@contember/react-binding": "
|
|
33
|
-
"@contember/react-repeater": "
|
|
34
|
-
"@contember/react-utils": "
|
|
35
|
-
"@dnd-kit/core": "
|
|
36
|
-
"@dnd-kit/sortable": "
|
|
37
|
-
"@radix-ui/react-portal": "
|
|
38
|
-
"@radix-ui/react-slot": "
|
|
32
|
+
"@contember/react-binding": "workspace:*",
|
|
33
|
+
"@contember/react-repeater": "workspace:*",
|
|
34
|
+
"@contember/react-utils": "workspace:*",
|
|
35
|
+
"@dnd-kit/core": "catalog:",
|
|
36
|
+
"@dnd-kit/sortable": "catalog:",
|
|
37
|
+
"@radix-ui/react-portal": "catalog:",
|
|
38
|
+
"@radix-ui/react-slot": "catalog:"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"react": "
|
|
42
|
-
"react-dom": "
|
|
41
|
+
"react": "catalog:",
|
|
42
|
+
"react-dom": "catalog:"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"react": "
|
|
46
|
-
"react-dom": "
|
|
45
|
+
"react": "catalog:",
|
|
46
|
+
"react-dom": "catalog:"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|
|
50
|
-
"url": "https://github.com/contember/
|
|
50
|
+
"url": "git+https://github.com/contember/contember.git",
|
|
51
51
|
"directory": "packages/react-repeater-dnd-kit"
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import React, { ReactNode, useCallback, useMemo, useState } from 'react'
|
|
2
2
|
import type { DragStartEvent } from '@dnd-kit/core'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
closestCenter,
|
|
5
|
+
DndContext,
|
|
6
|
+
DndContextProps,
|
|
7
|
+
DragCancelEvent,
|
|
8
|
+
DragEndEvent,
|
|
9
|
+
KeyboardSensor,
|
|
10
|
+
MeasuringStrategy,
|
|
11
|
+
MouseSensor,
|
|
12
|
+
TouchSensor,
|
|
13
|
+
UniqueIdentifier,
|
|
14
|
+
useSensor,
|
|
15
|
+
useSensors,
|
|
16
|
+
} from '@dnd-kit/core'
|
|
4
17
|
import { RepeaterActiveEntityContext } from '../contexts'
|
|
5
18
|
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'
|
|
6
19
|
import { useRepeaterMethods, useRepeaterSortedEntities } from '@contember/react-repeater'
|
|
@@ -43,7 +56,6 @@ export const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn
|
|
|
43
56
|
const { moveItem } = useRepeaterMethods()
|
|
44
57
|
const entities = useRepeaterSortedEntities()
|
|
45
58
|
|
|
46
|
-
|
|
47
59
|
const activeItem = useMemo(() => {
|
|
48
60
|
if (!activeId) {
|
|
49
61
|
return undefined
|
package/src/contexts.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const contexts = require("./src/contexts.cjs");
|
|
4
|
-
const reactRepeater = require("@contember/react-repeater");
|
|
5
|
-
const RepeaterSortable = require("./src/components/RepeaterSortable.cjs");
|
|
6
|
-
const RepeaterSortableDragOverlay = require("./src/components/RepeaterSortableDragOverlay.cjs");
|
|
7
|
-
const RepeaterSortableDropIndicator = require("./src/components/RepeaterSortableDropIndicator.cjs");
|
|
8
|
-
const RepeaterSortableItemActivator = require("./src/components/RepeaterSortableItemActivator.cjs");
|
|
9
|
-
const RepeaterSortableItemNode = require("./src/components/RepeaterSortableItemNode.cjs");
|
|
10
|
-
const RepeaterSortableEachItem = require("./src/components/RepeaterSortableEachItem.cjs");
|
|
11
|
-
exports.RepeaterActiveEntityContext = contexts.RepeaterActiveEntityContext;
|
|
12
|
-
exports.RepeaterSortableItemContext = contexts.RepeaterSortableItemContext;
|
|
13
|
-
exports.useRepeaterActiveEntity = contexts.useRepeaterActiveEntity;
|
|
14
|
-
exports.useRepeaterSortableItem = contexts.useRepeaterSortableItem;
|
|
15
|
-
exports.RepeaterSortable = RepeaterSortable.RepeaterSortable;
|
|
16
|
-
exports.RepeaterSortableDragOverlay = RepeaterSortableDragOverlay.RepeaterSortableDragOverlay;
|
|
17
|
-
exports.RepeaterSortableDropIndicator = RepeaterSortableDropIndicator.RepeaterSortableDropIndicator;
|
|
18
|
-
exports.RepeaterSortableItemActivator = RepeaterSortableItemActivator.RepeaterSortableItemActivator;
|
|
19
|
-
exports.RepeaterSortableItemNode = RepeaterSortableItemNode.RepeaterSortableItemNode;
|
|
20
|
-
exports.RepeaterSortableEachItem = RepeaterSortableEachItem.RepeaterSortableEachItem;
|
|
21
|
-
Object.keys(reactRepeater).forEach((k) => {
|
|
22
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: () => reactRepeater[k]
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RepeaterActiveEntityContext, RepeaterSortableItemContext, useRepeaterActiveEntity, useRepeaterSortableItem } from "./src/contexts.js";
|
|
2
|
-
export * from "@contember/react-repeater";
|
|
3
|
-
import { RepeaterSortable } from "./src/components/RepeaterSortable.js";
|
|
4
|
-
import { RepeaterSortableDragOverlay } from "./src/components/RepeaterSortableDragOverlay.js";
|
|
5
|
-
import { RepeaterSortableDropIndicator } from "./src/components/RepeaterSortableDropIndicator.js";
|
|
6
|
-
import { RepeaterSortableItemActivator } from "./src/components/RepeaterSortableItemActivator.js";
|
|
7
|
-
import { RepeaterSortableItemNode } from "./src/components/RepeaterSortableItemNode.js";
|
|
8
|
-
import { RepeaterSortableEachItem } from "./src/components/RepeaterSortableEachItem.js";
|
|
9
|
-
export {
|
|
10
|
-
RepeaterActiveEntityContext,
|
|
11
|
-
RepeaterSortable,
|
|
12
|
-
RepeaterSortableDragOverlay,
|
|
13
|
-
RepeaterSortableDropIndicator,
|
|
14
|
-
RepeaterSortableEachItem,
|
|
15
|
-
RepeaterSortableItemActivator,
|
|
16
|
-
RepeaterSortableItemContext,
|
|
17
|
-
RepeaterSortableItemNode,
|
|
18
|
-
useRepeaterActiveEntity,
|
|
19
|
-
useRepeaterSortableItem
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const core = require("@dnd-kit/core");
|
|
6
|
-
const contexts = require("../contexts.cjs");
|
|
7
|
-
const sortable = require("@dnd-kit/sortable");
|
|
8
|
-
const reactRepeater = require("@contember/react-repeater");
|
|
9
|
-
const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }) => {
|
|
10
|
-
const [activeId, setActiveId] = React.useState(null);
|
|
11
|
-
const { moveItem } = reactRepeater.useRepeaterMethods();
|
|
12
|
-
const entities = reactRepeater.useRepeaterSortedEntities();
|
|
13
|
-
const activeItem = React.useMemo(() => {
|
|
14
|
-
if (!activeId) {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
return entities.find((it) => it.id === activeId);
|
|
18
|
-
}, [activeId, entities]);
|
|
19
|
-
const sensors = core.useSensors(
|
|
20
|
-
core.useSensor(core.MouseSensor),
|
|
21
|
-
core.useSensor(core.TouchSensor),
|
|
22
|
-
core.useSensor(core.KeyboardSensor)
|
|
23
|
-
);
|
|
24
|
-
const onDragCancel = (event) => {
|
|
25
|
-
onDragCancelIn?.(event);
|
|
26
|
-
setActiveId(null);
|
|
27
|
-
};
|
|
28
|
-
const onDragEnd = React.useCallback((event) => {
|
|
29
|
-
onDragEndIn?.(event);
|
|
30
|
-
setActiveId(null);
|
|
31
|
-
const { active, over } = event;
|
|
32
|
-
const activeEntity = entities.find((it) => it.id === active.id);
|
|
33
|
-
const overIndex = over ? entities.findIndex((it) => it.id === over.id) : void 0;
|
|
34
|
-
if (!activeEntity || overIndex === void 0) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
moveItem?.(activeEntity, overIndex);
|
|
38
|
-
}, [entities, moveItem, onDragEndIn]);
|
|
39
|
-
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
40
|
-
core.DndContext,
|
|
41
|
-
{
|
|
42
|
-
sensors,
|
|
43
|
-
measuring: {
|
|
44
|
-
droppable: {
|
|
45
|
-
strategy: core.MeasuringStrategy.Always
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
collisionDetection: core.closestCenter,
|
|
49
|
-
...props,
|
|
50
|
-
onDragStart: (event) => {
|
|
51
|
-
onDragStart?.(event);
|
|
52
|
-
setActiveId(event.active.id);
|
|
53
|
-
},
|
|
54
|
-
onDragEnd,
|
|
55
|
-
onDragCancel,
|
|
56
|
-
children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(sortable.SortableContext, { items: entities, strategy: sortable.verticalListSortingStrategy, children }, void 0, false, {
|
|
57
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
58
|
-
lineNumber: 95,
|
|
59
|
-
columnNumber: 5
|
|
60
|
-
}, void 0) }, void 0, false, {
|
|
61
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
62
|
-
lineNumber: 94,
|
|
63
|
-
columnNumber: 4
|
|
64
|
-
}, void 0)
|
|
65
|
-
},
|
|
66
|
-
void 0,
|
|
67
|
-
false,
|
|
68
|
-
{
|
|
69
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
70
|
-
lineNumber: 78,
|
|
71
|
-
columnNumber: 3
|
|
72
|
-
},
|
|
73
|
-
void 0
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
exports.RepeaterSortable = RepeaterSortable;
|
|
77
|
-
//# sourceMappingURL=RepeaterSortable.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortable.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport type { DragStartEvent } from '@dnd-kit/core'\nimport { closestCenter, DndContext, DndContextProps, DragCancelEvent, DragEndEvent, KeyboardSensor, MeasuringStrategy, MouseSensor, TouchSensor, UniqueIdentifier, useSensor, useSensors } from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../contexts'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { useRepeaterMethods, useRepeaterSortedEntities } from '@contember/react-repeater'\n\n/**\n * Initializes dnd-kit based sorting for the repeater.\n * Using the props, you can customize the behavior of the sorting and hook into the drag events.\n *\n * ## Example\n * ```tsx\n * <Repeater {...}>\n * <RepeaterSortable>\n * <RepeaterSortableEachItem>\n * <div>\n * <RepeaterSortableDropIndicator position={'before'}><div>Drop here</div></RepeaterSortableDropIndicator>\n * <RepeaterSortableItemNode>\n * <div>\n * <RepeaterSortableItemActivator>\n * <span/>\n * </RepeaterSortableItemActivator>\n * {children}\n * </div>\n * </RepeaterSortableItemNode>\n * <RepeaterSortableDropIndicator position={'afer'}><div>Drop here</div></RepeaterSortableDropIndicator>\n * </div>\n * </RepeaterSortableEachItem>\n * <RepeaterSortableDragOverlay>\n * <div>\n * {children}\n * </div>\n * </RepeaterSortableDragOverlay>\n * </RepeaterSortable>\n * </Repeater>\n * ```\n */\nexport const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }: {\n\tchildren: ReactNode\n} & DndContextProps) => {\n\tconst [activeId, setActiveId] = useState<UniqueIdentifier | null>(null)\n\tconst { moveItem } = useRepeaterMethods()\n\tconst entities = useRepeaterSortedEntities()\n\n\n\tconst activeItem = useMemo(() => {\n\t\tif (!activeId) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn entities.find(it => it.id === activeId)\n\t}, [activeId, entities])\n\n\tconst sensors = useSensors(\n\t\tuseSensor(MouseSensor),\n\t\tuseSensor(TouchSensor),\n\t\tuseSensor(KeyboardSensor),\n\t)\n\n\tconst onDragCancel = (event: DragCancelEvent) => {\n\t\tonDragCancelIn?.(event)\n\t\tsetActiveId(null)\n\t}\n\n\tconst onDragEnd = useCallback((event: DragEndEvent) => {\n\t\tonDragEndIn?.(event)\n\t\tsetActiveId(null)\n\t\tconst { active, over } = event\n\t\tconst activeEntity = entities.find(it => it.id === active.id)\n\t\tconst overIndex = over ? entities.findIndex(it => it.id === over.id) : undefined\n\t\tif (!activeEntity || overIndex === undefined) {\n\t\t\treturn\n\t\t}\n\t\tmoveItem?.(activeEntity, overIndex)\n\t}, [entities, moveItem, onDragEndIn])\n\n\treturn (\n\t\t<DndContext\n\t\t\tsensors={sensors}\n\t\t\tmeasuring={{\n\t\t\t\tdroppable: {\n\t\t\t\t\tstrategy: MeasuringStrategy.Always,\n\t\t\t\t},\n\t\t\t}}\n\t\t\tcollisionDetection={closestCenter}\n\t\t\t{...props}\n\t\t\tonDragStart={(event: DragStartEvent) => {\n\t\t\t\tonDragStart?.(event)\n\t\t\t\tsetActiveId(event.active.id)\n\t\t\t}}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDragCancel={onDragCancel}\n\t\t>\n\t\t\t<RepeaterActiveEntityContext.Provider value={activeItem}>\n\t\t\t\t<SortableContext items={entities} strategy={verticalListSortingStrategy}>\n\t\t\t\t\t{children}\n\t\t\t\t</SortableContext>\n\t\t\t</RepeaterActiveEntityContext.Provider>\n\t\t</DndContext>\n\t)\n}\n"],"names":["useState","useRepeaterMethods","useRepeaterSortedEntities","useMemo","useSensors","useSensor","MouseSensor","TouchSensor","KeyboardSensor","useCallback","jsxDEV","DndContext","MeasuringStrategy","closestCenter","RepeaterActiveEntityContext","SortableContext","verticalListSortingStrategy","this"],"mappings":";;;;;;;;AAsCa,MAAA,mBAAmB,CAAC,EAAE,UAAU,aAAa,WAAW,aAAa,cAAc,gBAAgB,GAAG,YAE3F;AACvB,QAAM,CAAC,UAAU,WAAW,IAAIA,MAAAA,SAAkC,IAAI;AAChE,QAAA,EAAE,SAAS,IAAIC,iCAAmB;AACxC,QAAM,WAAWC,cAAAA,0BAA0B;AAGrC,QAAA,aAAaC,MAAAA,QAAQ,MAAM;AAChC,QAAI,CAAC,UAAU;AACP,aAAA;AAAA,IAAA;AAER,WAAO,SAAS,KAAK,CAAM,OAAA,GAAG,OAAO,QAAQ;AAAA,EAAA,GAC3C,CAAC,UAAU,QAAQ,CAAC;AAEvB,QAAM,UAAUC,KAAA;AAAA,IACfC,KAAAA,UAAUC,KAAAA,WAAW;AAAA,IACrBD,KAAAA,UAAUE,KAAAA,WAAW;AAAA,IACrBF,KAAAA,UAAUG,KAAc,cAAA;AAAA,EACzB;AAEM,QAAA,eAAe,CAAC,UAA2B;AAChD,qBAAiB,KAAK;AACtB,gBAAY,IAAI;AAAA,EACjB;AAEM,QAAA,YAAYC,kBAAY,CAAC,UAAwB;AACtD,kBAAc,KAAK;AACnB,gBAAY,IAAI;AACV,UAAA,EAAE,QAAQ,KAAA,IAAS;AACzB,UAAM,eAAe,SAAS,KAAK,QAAM,GAAG,OAAO,OAAO,EAAE;AACtD,UAAA,YAAY,OAAO,SAAS,UAAU,QAAM,GAAG,OAAO,KAAK,EAAE,IAAI;AACnE,QAAA,CAAC,gBAAgB,cAAc,QAAW;AAC7C;AAAA,IAAA;AAED,eAAW,cAAc,SAAS;AAAA,EAChC,GAAA,CAAC,UAAU,UAAU,WAAW,CAAC;AAGnC,SAAAC,8BAAA;AAAA,IAACC,KAAA;AAAA,IAAA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV,WAAW;AAAA,UACV,UAAUC,KAAAA,kBAAkB;AAAA,QAAA;AAAA,MAE9B;AAAA,MACA,oBAAoBC,KAAA;AAAA,MACnB,GAAG;AAAA,MACJ,aAAa,CAAC,UAA0B;AACvC,sBAAc,KAAK;AACP,oBAAA,MAAM,OAAO,EAAE;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MAEA,UAACH,8BAAA,OAAAI,qCAA4B,UAA5B,EAAqC,OAAO,YAC5C,UAACJ,8BAAA,OAAAK,SAAA,iBAAA,EAAgB,OAAO,UAAU,UAAUC,SAAAA,6BAC1C,YADF,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAC,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAIAA,MAAA;AAAA,IAAA;AAAA,IApBD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAqBA;AAEF;;"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
import { useState, useMemo, useCallback } from "react";
|
|
3
|
-
import { useSensors, useSensor, MouseSensor, TouchSensor, KeyboardSensor, DndContext, MeasuringStrategy, closestCenter } from "@dnd-kit/core";
|
|
4
|
-
import { RepeaterActiveEntityContext } from "../contexts.js";
|
|
5
|
-
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
6
|
-
import { useRepeaterMethods, useRepeaterSortedEntities } from "@contember/react-repeater";
|
|
7
|
-
const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }) => {
|
|
8
|
-
const [activeId, setActiveId] = useState(null);
|
|
9
|
-
const { moveItem } = useRepeaterMethods();
|
|
10
|
-
const entities = useRepeaterSortedEntities();
|
|
11
|
-
const activeItem = useMemo(() => {
|
|
12
|
-
if (!activeId) {
|
|
13
|
-
return void 0;
|
|
14
|
-
}
|
|
15
|
-
return entities.find((it) => it.id === activeId);
|
|
16
|
-
}, [activeId, entities]);
|
|
17
|
-
const sensors = useSensors(
|
|
18
|
-
useSensor(MouseSensor),
|
|
19
|
-
useSensor(TouchSensor),
|
|
20
|
-
useSensor(KeyboardSensor)
|
|
21
|
-
);
|
|
22
|
-
const onDragCancel = (event) => {
|
|
23
|
-
onDragCancelIn?.(event);
|
|
24
|
-
setActiveId(null);
|
|
25
|
-
};
|
|
26
|
-
const onDragEnd = useCallback((event) => {
|
|
27
|
-
onDragEndIn?.(event);
|
|
28
|
-
setActiveId(null);
|
|
29
|
-
const { active, over } = event;
|
|
30
|
-
const activeEntity = entities.find((it) => it.id === active.id);
|
|
31
|
-
const overIndex = over ? entities.findIndex((it) => it.id === over.id) : void 0;
|
|
32
|
-
if (!activeEntity || overIndex === void 0) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
moveItem?.(activeEntity, overIndex);
|
|
36
|
-
}, [entities, moveItem, onDragEndIn]);
|
|
37
|
-
return /* @__PURE__ */ jsxDEV(
|
|
38
|
-
DndContext,
|
|
39
|
-
{
|
|
40
|
-
sensors,
|
|
41
|
-
measuring: {
|
|
42
|
-
droppable: {
|
|
43
|
-
strategy: MeasuringStrategy.Always
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
collisionDetection: closestCenter,
|
|
47
|
-
...props,
|
|
48
|
-
onDragStart: (event) => {
|
|
49
|
-
onDragStart?.(event);
|
|
50
|
-
setActiveId(event.active.id);
|
|
51
|
-
},
|
|
52
|
-
onDragEnd,
|
|
53
|
-
onDragCancel,
|
|
54
|
-
children: /* @__PURE__ */ jsxDEV(RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsxDEV(SortableContext, { items: entities, strategy: verticalListSortingStrategy, children }, void 0, false, {
|
|
55
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
56
|
-
lineNumber: 95,
|
|
57
|
-
columnNumber: 5
|
|
58
|
-
}, void 0) }, void 0, false, {
|
|
59
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
60
|
-
lineNumber: 94,
|
|
61
|
-
columnNumber: 4
|
|
62
|
-
}, void 0)
|
|
63
|
-
},
|
|
64
|
-
void 0,
|
|
65
|
-
false,
|
|
66
|
-
{
|
|
67
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
68
|
-
lineNumber: 78,
|
|
69
|
-
columnNumber: 3
|
|
70
|
-
},
|
|
71
|
-
void 0
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
export {
|
|
75
|
-
RepeaterSortable
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=RepeaterSortable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortable.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport type { DragStartEvent } from '@dnd-kit/core'\nimport { closestCenter, DndContext, DndContextProps, DragCancelEvent, DragEndEvent, KeyboardSensor, MeasuringStrategy, MouseSensor, TouchSensor, UniqueIdentifier, useSensor, useSensors } from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../contexts'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { useRepeaterMethods, useRepeaterSortedEntities } from '@contember/react-repeater'\n\n/**\n * Initializes dnd-kit based sorting for the repeater.\n * Using the props, you can customize the behavior of the sorting and hook into the drag events.\n *\n * ## Example\n * ```tsx\n * <Repeater {...}>\n * <RepeaterSortable>\n * <RepeaterSortableEachItem>\n * <div>\n * <RepeaterSortableDropIndicator position={'before'}><div>Drop here</div></RepeaterSortableDropIndicator>\n * <RepeaterSortableItemNode>\n * <div>\n * <RepeaterSortableItemActivator>\n * <span/>\n * </RepeaterSortableItemActivator>\n * {children}\n * </div>\n * </RepeaterSortableItemNode>\n * <RepeaterSortableDropIndicator position={'afer'}><div>Drop here</div></RepeaterSortableDropIndicator>\n * </div>\n * </RepeaterSortableEachItem>\n * <RepeaterSortableDragOverlay>\n * <div>\n * {children}\n * </div>\n * </RepeaterSortableDragOverlay>\n * </RepeaterSortable>\n * </Repeater>\n * ```\n */\nexport const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }: {\n\tchildren: ReactNode\n} & DndContextProps) => {\n\tconst [activeId, setActiveId] = useState<UniqueIdentifier | null>(null)\n\tconst { moveItem } = useRepeaterMethods()\n\tconst entities = useRepeaterSortedEntities()\n\n\n\tconst activeItem = useMemo(() => {\n\t\tif (!activeId) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn entities.find(it => it.id === activeId)\n\t}, [activeId, entities])\n\n\tconst sensors = useSensors(\n\t\tuseSensor(MouseSensor),\n\t\tuseSensor(TouchSensor),\n\t\tuseSensor(KeyboardSensor),\n\t)\n\n\tconst onDragCancel = (event: DragCancelEvent) => {\n\t\tonDragCancelIn?.(event)\n\t\tsetActiveId(null)\n\t}\n\n\tconst onDragEnd = useCallback((event: DragEndEvent) => {\n\t\tonDragEndIn?.(event)\n\t\tsetActiveId(null)\n\t\tconst { active, over } = event\n\t\tconst activeEntity = entities.find(it => it.id === active.id)\n\t\tconst overIndex = over ? entities.findIndex(it => it.id === over.id) : undefined\n\t\tif (!activeEntity || overIndex === undefined) {\n\t\t\treturn\n\t\t}\n\t\tmoveItem?.(activeEntity, overIndex)\n\t}, [entities, moveItem, onDragEndIn])\n\n\treturn (\n\t\t<DndContext\n\t\t\tsensors={sensors}\n\t\t\tmeasuring={{\n\t\t\t\tdroppable: {\n\t\t\t\t\tstrategy: MeasuringStrategy.Always,\n\t\t\t\t},\n\t\t\t}}\n\t\t\tcollisionDetection={closestCenter}\n\t\t\t{...props}\n\t\t\tonDragStart={(event: DragStartEvent) => {\n\t\t\t\tonDragStart?.(event)\n\t\t\t\tsetActiveId(event.active.id)\n\t\t\t}}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDragCancel={onDragCancel}\n\t\t>\n\t\t\t<RepeaterActiveEntityContext.Provider value={activeItem}>\n\t\t\t\t<SortableContext items={entities} strategy={verticalListSortingStrategy}>\n\t\t\t\t\t{children}\n\t\t\t\t</SortableContext>\n\t\t\t</RepeaterActiveEntityContext.Provider>\n\t\t</DndContext>\n\t)\n}\n"],"names":["this"],"mappings":";;;;;;AAsCa,MAAA,mBAAmB,CAAC,EAAE,UAAU,aAAa,WAAW,aAAa,cAAc,gBAAgB,GAAG,YAE3F;AACvB,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkC,IAAI;AAChE,QAAA,EAAE,SAAS,IAAI,mBAAmB;AACxC,QAAM,WAAW,0BAA0B;AAGrC,QAAA,aAAa,QAAQ,MAAM;AAChC,QAAI,CAAC,UAAU;AACP,aAAA;AAAA,IAAA;AAER,WAAO,SAAS,KAAK,CAAM,OAAA,GAAG,OAAO,QAAQ;AAAA,EAAA,GAC3C,CAAC,UAAU,QAAQ,CAAC;AAEvB,QAAM,UAAU;AAAA,IACf,UAAU,WAAW;AAAA,IACrB,UAAU,WAAW;AAAA,IACrB,UAAU,cAAc;AAAA,EACzB;AAEM,QAAA,eAAe,CAAC,UAA2B;AAChD,qBAAiB,KAAK;AACtB,gBAAY,IAAI;AAAA,EACjB;AAEM,QAAA,YAAY,YAAY,CAAC,UAAwB;AACtD,kBAAc,KAAK;AACnB,gBAAY,IAAI;AACV,UAAA,EAAE,QAAQ,KAAA,IAAS;AACzB,UAAM,eAAe,SAAS,KAAK,QAAM,GAAG,OAAO,OAAO,EAAE;AACtD,UAAA,YAAY,OAAO,SAAS,UAAU,QAAM,GAAG,OAAO,KAAK,EAAE,IAAI;AACnE,QAAA,CAAC,gBAAgB,cAAc,QAAW;AAC7C;AAAA,IAAA;AAED,eAAW,cAAc,SAAS;AAAA,EAChC,GAAA,CAAC,UAAU,UAAU,WAAW,CAAC;AAGnC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV,WAAW;AAAA,UACV,UAAU,kBAAkB;AAAA,QAAA;AAAA,MAE9B;AAAA,MACA,oBAAoB;AAAA,MACnB,GAAG;AAAA,MACJ,aAAa,CAAC,UAA0B;AACvC,sBAAc,KAAK;AACP,oBAAA,MAAM,OAAO,EAAE;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MAEA,UAAC,uBAAA,4BAA4B,UAA5B,EAAqC,OAAO,YAC5C,UAAC,uBAAA,iBAAA,EAAgB,OAAO,UAAU,UAAU,6BAC1C,YADF,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAIAA,MAAA;AAAA,IAAA;AAAA,IApBD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAqBA;AAEF;"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const contexts = require("../contexts.cjs");
|
|
5
|
-
const reactPortal = require("@radix-ui/react-portal");
|
|
6
|
-
const core = require("@dnd-kit/core");
|
|
7
|
-
const reactBinding = require("@contember/react-binding");
|
|
8
|
-
const reactRepeater = require("@contember/react-repeater");
|
|
9
|
-
const RepeaterSortableDragOverlay = ({ children }) => {
|
|
10
|
-
const activeItem = contexts.useRepeaterActiveEntity();
|
|
11
|
-
const accessorTreeState = reactBinding.useAccessorTreeState();
|
|
12
|
-
if (!activeItem) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactPortal.Portal, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(core.DragOverlay, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.AccessorTree, { state: accessorTreeState, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.Entity, { accessor: activeItem, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactRepeater.RepeaterCurrentEntityContext.Provider, { value: activeItem, children }, void 0, false, {
|
|
16
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
17
|
-
lineNumber: 24,
|
|
18
|
-
columnNumber: 7
|
|
19
|
-
}, void 0) }, void 0, false, {
|
|
20
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
21
|
-
lineNumber: 23,
|
|
22
|
-
columnNumber: 6
|
|
23
|
-
}, void 0) }, void 0, false, {
|
|
24
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
25
|
-
lineNumber: 22,
|
|
26
|
-
columnNumber: 5
|
|
27
|
-
}, void 0) }, void 0, false, {
|
|
28
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
29
|
-
lineNumber: 21,
|
|
30
|
-
columnNumber: 4
|
|
31
|
-
}, void 0) }, void 0, false, {
|
|
32
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
33
|
-
lineNumber: 20,
|
|
34
|
-
columnNumber: 3
|
|
35
|
-
}, void 0);
|
|
36
|
-
};
|
|
37
|
-
exports.RepeaterSortableDragOverlay = RepeaterSortableDragOverlay;
|
|
38
|
-
//# sourceMappingURL=RepeaterSortableDragOverlay.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDragOverlay.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterActiveEntity } from '../contexts'\nimport { Portal } from '@radix-ui/react-portal'\nimport { DragOverlay } from '@dnd-kit/core'\nimport { AccessorTree, Entity, useAccessorTreeState } from '@contember/react-binding'\nimport { RepeaterCurrentEntityContext } from '@contember/react-repeater'\n\n/**\n * Component for rendering the repeater item being dragged.\n */\nexport const RepeaterSortableDragOverlay = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst activeItem = useRepeaterActiveEntity()\n\tconst accessorTreeState = useAccessorTreeState()\n\tif (!activeItem) {\n\t\treturn null\n\t}\n\treturn (\n\t\t<Portal>\n\t\t\t<DragOverlay>\n\t\t\t\t<AccessorTree state={accessorTreeState}>\n\t\t\t\t\t<Entity accessor={activeItem}>\n\t\t\t\t\t\t<RepeaterCurrentEntityContext.Provider value={activeItem}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</RepeaterCurrentEntityContext.Provider>\n\t\t\t\t\t</Entity>\n\t\t\t\t</AccessorTree>\n\t\t\t</DragOverlay>\n\t\t</Portal>\n\t)\n}\n"],"names":["useRepeaterActiveEntity","useAccessorTreeState","Portal","jsxDEV","DragOverlay","AccessorTree","Entity","RepeaterCurrentEntityContext","this"],"mappings":";;;;;;;;AAUO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAaA,SAAAA,wBAAwB;AAC3C,QAAM,oBAAoBC,aAAAA,qBAAqB;AAC/C,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EAAA;AAER,8CACEC,YACA,QAAA,EAAA,UAAAC,8BAAA,OAACC,oBACA,UAACD,8BAAA,OAAAE,aAAA,cAAA,EAAa,OAAO,mBACpB,UAAAF,8BAAAA,OAACG,aAAO,QAAA,EAAA,UAAU,YACjB,UAACH,8BAAAA,OAAAI,cAAAA,6BAA6B,UAA7B,EAAsC,OAAO,YAC5C,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA,EALD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAMA,EAPD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAQA,EATD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAUA,GAAAA,MAAA;AAEF;;"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
import { useRepeaterActiveEntity } from "../contexts.js";
|
|
3
|
-
import { Portal } from "@radix-ui/react-portal";
|
|
4
|
-
import { DragOverlay } from "@dnd-kit/core";
|
|
5
|
-
import { useAccessorTreeState, AccessorTree, Entity } from "@contember/react-binding";
|
|
6
|
-
import { RepeaterCurrentEntityContext } from "@contember/react-repeater";
|
|
7
|
-
const RepeaterSortableDragOverlay = ({ children }) => {
|
|
8
|
-
const activeItem = useRepeaterActiveEntity();
|
|
9
|
-
const accessorTreeState = useAccessorTreeState();
|
|
10
|
-
if (!activeItem) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return /* @__PURE__ */ jsxDEV(Portal, { children: /* @__PURE__ */ jsxDEV(DragOverlay, { children: /* @__PURE__ */ jsxDEV(AccessorTree, { state: accessorTreeState, children: /* @__PURE__ */ jsxDEV(Entity, { accessor: activeItem, children: /* @__PURE__ */ jsxDEV(RepeaterCurrentEntityContext.Provider, { value: activeItem, children }, void 0, false, {
|
|
14
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
15
|
-
lineNumber: 24,
|
|
16
|
-
columnNumber: 7
|
|
17
|
-
}, void 0) }, void 0, false, {
|
|
18
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
19
|
-
lineNumber: 23,
|
|
20
|
-
columnNumber: 6
|
|
21
|
-
}, void 0) }, void 0, false, {
|
|
22
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
23
|
-
lineNumber: 22,
|
|
24
|
-
columnNumber: 5
|
|
25
|
-
}, void 0) }, void 0, false, {
|
|
26
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
27
|
-
lineNumber: 21,
|
|
28
|
-
columnNumber: 4
|
|
29
|
-
}, void 0) }, void 0, false, {
|
|
30
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
|
|
31
|
-
lineNumber: 20,
|
|
32
|
-
columnNumber: 3
|
|
33
|
-
}, void 0);
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
RepeaterSortableDragOverlay
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=RepeaterSortableDragOverlay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDragOverlay.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterActiveEntity } from '../contexts'\nimport { Portal } from '@radix-ui/react-portal'\nimport { DragOverlay } from '@dnd-kit/core'\nimport { AccessorTree, Entity, useAccessorTreeState } from '@contember/react-binding'\nimport { RepeaterCurrentEntityContext } from '@contember/react-repeater'\n\n/**\n * Component for rendering the repeater item being dragged.\n */\nexport const RepeaterSortableDragOverlay = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst activeItem = useRepeaterActiveEntity()\n\tconst accessorTreeState = useAccessorTreeState()\n\tif (!activeItem) {\n\t\treturn null\n\t}\n\treturn (\n\t\t<Portal>\n\t\t\t<DragOverlay>\n\t\t\t\t<AccessorTree state={accessorTreeState}>\n\t\t\t\t\t<Entity accessor={activeItem}>\n\t\t\t\t\t\t<RepeaterCurrentEntityContext.Provider value={activeItem}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</RepeaterCurrentEntityContext.Provider>\n\t\t\t\t\t</Entity>\n\t\t\t\t</AccessorTree>\n\t\t\t</DragOverlay>\n\t\t</Portal>\n\t)\n}\n"],"names":["this"],"mappings":";;;;;;AAUO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAa,wBAAwB;AAC3C,QAAM,oBAAoB,qBAAqB;AAC/C,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EAAA;AAER,gCACE,QACA,EAAA,UAAA,uBAAC,eACA,UAAC,uBAAA,cAAA,EAAa,OAAO,mBACpB,UAAA,uBAAC,QAAO,EAAA,UAAU,YACjB,UAAC,uBAAA,6BAA6B,UAA7B,EAAsC,OAAO,YAC5C,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA,EALD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAMA,EAPD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAQA,EATD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAUA,GAAAA,MAAA;AAEF;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const contexts = require("../contexts.cjs");
|
|
5
|
-
const RepeaterSortableDropIndicator = ({ children, position }) => {
|
|
6
|
-
const sortable = contexts.useRepeaterSortableItem();
|
|
7
|
-
const isOver = sortable.isOver;
|
|
8
|
-
const activeSortable = sortable.active?.data.current?.sortable;
|
|
9
|
-
const isAfter = (sortable.data?.sortable.index ?? 0) > activeSortable?.index;
|
|
10
|
-
const renderedPosition = isAfter ? "after" : "before";
|
|
11
|
-
return renderedPosition === position && isOver ? /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children }, void 0, false, {
|
|
12
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDropIndicator.tsx",
|
|
13
|
-
lineNumber: 17,
|
|
14
|
-
columnNumber: 51
|
|
15
|
-
}, void 0) : null;
|
|
16
|
-
};
|
|
17
|
-
exports.RepeaterSortableDropIndicator = RepeaterSortableDropIndicator;
|
|
18
|
-
//# sourceMappingURL=RepeaterSortableDropIndicator.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDropIndicator.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\n\n/**\n * Renders a child element when the repeater item is being dragged over the drop indicator.\n */\nexport const RepeaterSortableDropIndicator = ({ children, position }: {\n\tchildren: ReactNode\n\tposition: 'before' | 'after'\n}) => {\n\tconst sortable = useRepeaterSortableItem()\n\tconst isOver = sortable.isOver\n\tconst activeSortable = sortable.active?.data.current?.sortable\n\tconst isAfter = (sortable.data?.sortable.index ?? 0) > activeSortable?.index\n\tconst renderedPosition = isAfter ? 'after' : 'before'\n\n\treturn renderedPosition === position && isOver ? <>{children}</> : null\n}\n"],"names":["useRepeaterSortableItem","jsxDEV","Fragment","this"],"mappings":";;;;AAMO,MAAM,gCAAgC,CAAC,EAAE,UAAU,eAGpD;AACL,QAAM,WAAWA,SAAAA,wBAAwB;AACzC,QAAM,SAAS,SAAS;AACxB,QAAM,iBAAiB,SAAS,QAAQ,KAAK,SAAS;AACtD,QAAM,WAAW,SAAS,MAAM,SAAS,SAAS,KAAK,gBAAgB;AACjE,QAAA,mBAAmB,UAAU,UAAU;AAE7C,SAAO,qBAAqB,YAAY,SAASC,8BAAA,OAAAC,wBAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAY,IAAM;AACpE;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
2
|
-
import { useRepeaterSortableItem } from "../contexts.js";
|
|
3
|
-
const RepeaterSortableDropIndicator = ({ children, position }) => {
|
|
4
|
-
const sortable = useRepeaterSortableItem();
|
|
5
|
-
const isOver = sortable.isOver;
|
|
6
|
-
const activeSortable = sortable.active?.data.current?.sortable;
|
|
7
|
-
const isAfter = (sortable.data?.sortable.index ?? 0) > activeSortable?.index;
|
|
8
|
-
const renderedPosition = isAfter ? "after" : "before";
|
|
9
|
-
return renderedPosition === position && isOver ? /* @__PURE__ */ jsxDEV(Fragment, { children }, void 0, false, {
|
|
10
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDropIndicator.tsx",
|
|
11
|
-
lineNumber: 17,
|
|
12
|
-
columnNumber: 51
|
|
13
|
-
}, void 0) : null;
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
RepeaterSortableDropIndicator
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=RepeaterSortableDropIndicator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDropIndicator.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\n\n/**\n * Renders a child element when the repeater item is being dragged over the drop indicator.\n */\nexport const RepeaterSortableDropIndicator = ({ children, position }: {\n\tchildren: ReactNode\n\tposition: 'before' | 'after'\n}) => {\n\tconst sortable = useRepeaterSortableItem()\n\tconst isOver = sortable.isOver\n\tconst activeSortable = sortable.active?.data.current?.sortable\n\tconst isAfter = (sortable.data?.sortable.index ?? 0) > activeSortable?.index\n\tconst renderedPosition = isAfter ? 'after' : 'before'\n\n\treturn renderedPosition === position && isOver ? <>{children}</> : null\n}\n"],"names":["this"],"mappings":";;AAMO,MAAM,gCAAgC,CAAC,EAAE,UAAU,eAGpD;AACL,QAAM,WAAW,wBAAwB;AACzC,QAAM,SAAS,SAAS;AACxB,QAAM,iBAAiB,SAAS,QAAQ,KAAK,SAAS;AACtD,QAAM,WAAW,SAAS,MAAM,SAAS,SAAS,KAAK,gBAAgB;AACjE,QAAA,mBAAmB,UAAU,UAAU;AAE7C,SAAO,qBAAqB,YAAY,SAAS,uBAAA,UAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAY,IAAM;AACpE;"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const sortable = require("@dnd-kit/sortable");
|
|
5
|
-
const reactRepeater = require("@contember/react-repeater");
|
|
6
|
-
const contexts = require("../contexts.cjs");
|
|
7
|
-
const reactBinding = require("@contember/react-binding");
|
|
8
|
-
const RepeaterSortableEachItem = ({ children }) => {
|
|
9
|
-
const entities = reactRepeater.useRepeaterSortedEntities();
|
|
10
|
-
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(sortable.SortableContext, { items: entities, strategy: sortable.verticalListSortingStrategy, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactRepeater.RepeaterEachItem, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(RepeaterSortableEachItemInner, { children }, void 0, false, {
|
|
11
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
|
|
12
|
-
lineNumber: 19,
|
|
13
|
-
columnNumber: 5
|
|
14
|
-
}, void 0) }, void 0, false, {
|
|
15
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
|
|
16
|
-
lineNumber: 18,
|
|
17
|
-
columnNumber: 4
|
|
18
|
-
}, void 0) }, void 0, false, {
|
|
19
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
|
|
20
|
-
lineNumber: 17,
|
|
21
|
-
columnNumber: 3
|
|
22
|
-
}, void 0);
|
|
23
|
-
};
|
|
24
|
-
const RepeaterSortableEachItemInner = ({ children }) => {
|
|
25
|
-
const entity = reactBinding.useEntity();
|
|
26
|
-
const sortable$1 = sortable.useSortable({
|
|
27
|
-
id: entity.id
|
|
28
|
-
});
|
|
29
|
-
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.RepeaterSortableItemContext.Provider, { value: sortable$1, children }, void 0, false, {
|
|
30
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
|
|
31
|
-
lineNumber: 35,
|
|
32
|
-
columnNumber: 3
|
|
33
|
-
}, void 0);
|
|
34
|
-
};
|
|
35
|
-
exports.RepeaterSortableEachItem = RepeaterSortableEachItem;
|
|
36
|
-
//# sourceMappingURL=RepeaterSortableEachItem.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableEachItem.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { RepeaterEachItem, useRepeaterSortedEntities } from '@contember/react-repeater'\nimport { RepeaterSortableItemContext } from '../contexts'\nimport { useEntity } from '@contember/react-binding'\n\n/**\n * Iterates over all entities in the repeater and renders the children for each entity.\n * Also sets up the dnd-kit sortable context for the repeater items.\n */\nexport const RepeaterSortableEachItem = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst entities = useRepeaterSortedEntities()\n\n\treturn (\n\t\t<SortableContext items={entities} strategy={verticalListSortingStrategy}>\n\t\t\t<RepeaterEachItem>\n\t\t\t\t<RepeaterSortableEachItemInner>\n\t\t\t\t\t{children}\n\t\t\t\t</RepeaterSortableEachItemInner>\n\n\t\t\t</RepeaterEachItem>\n\t\t</SortableContext>\n\t)\n}\nconst RepeaterSortableEachItemInner = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst entity = useEntity()\n\tconst sortable = useSortable({\n\t\tid: entity.id,\n\t})\n\treturn (\n\t\t<RepeaterSortableItemContext.Provider value={sortable}>\n\t\t\t{children}\n\t\t</RepeaterSortableItemContext.Provider>\n\t)\n}\n"],"names":["useRepeaterSortedEntities","jsxDEV","SortableContext","verticalListSortingStrategy","RepeaterEachItem","this","useEntity","sortable","useSortable","RepeaterSortableItemContext"],"mappings":";;;;;;;AAUO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACL,QAAM,WAAWA,cAAAA,0BAA0B;AAG1C,SAAAC,8BAAAA,OAACC,SAAAA,iBAAgB,EAAA,OAAO,UAAU,UAAUC,sCAC3C,UAACF,8BAAAA,OAAAG,cAAAA,kBAAA,EACA,UAACH,8BAAAA,OAAA,+BAAA,EACC,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAI,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAKA,EAND,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAOA,GAAAA,MAAA;AAEF;AACA,MAAM,gCAAgC,CAAC,EAAE,eAEnC;AACL,QAAM,SAASC,aAAAA,UAAU;AACzB,QAAMC,aAAWC,SAAAA,YAAY;AAAA,IAC5B,IAAI,OAAO;AAAA,EAAA,CACX;AACD,8CACEC,qCAA4B,UAA5B,EAAqC,OAAOF,YAC3C,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAF,MAAA;AAEF;;"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
import { SortableContext, verticalListSortingStrategy, useSortable } from "@dnd-kit/sortable";
|
|
3
|
-
import { useRepeaterSortedEntities, RepeaterEachItem } from "@contember/react-repeater";
|
|
4
|
-
import { RepeaterSortableItemContext } from "../contexts.js";
|
|
5
|
-
import { useEntity } from "@contember/react-binding";
|
|
6
|
-
const RepeaterSortableEachItem = ({ children }) => {
|
|
7
|
-
const entities = useRepeaterSortedEntities();
|
|
8
|
-
return /* @__PURE__ */ jsxDEV(SortableContext, { items: entities, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsxDEV(RepeaterEachItem, { children: /* @__PURE__ */ jsxDEV(RepeaterSortableEachItemInner, { children }, void 0, false, {
|
|
9
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
|
|
10
|
-
lineNumber: 19,
|
|
11
|
-
columnNumber: 5
|
|
12
|
-
}, void 0) }, void 0, false, {
|
|
13
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
|
|
14
|
-
lineNumber: 18,
|
|
15
|
-
columnNumber: 4
|
|
16
|
-
}, void 0) }, void 0, false, {
|
|
17
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
|
|
18
|
-
lineNumber: 17,
|
|
19
|
-
columnNumber: 3
|
|
20
|
-
}, void 0);
|
|
21
|
-
};
|
|
22
|
-
const RepeaterSortableEachItemInner = ({ children }) => {
|
|
23
|
-
const entity = useEntity();
|
|
24
|
-
const sortable = useSortable({
|
|
25
|
-
id: entity.id
|
|
26
|
-
});
|
|
27
|
-
return /* @__PURE__ */ jsxDEV(RepeaterSortableItemContext.Provider, { value: sortable, children }, void 0, false, {
|
|
28
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
|
|
29
|
-
lineNumber: 35,
|
|
30
|
-
columnNumber: 3
|
|
31
|
-
}, void 0);
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
RepeaterSortableEachItem
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=RepeaterSortableEachItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableEachItem.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { RepeaterEachItem, useRepeaterSortedEntities } from '@contember/react-repeater'\nimport { RepeaterSortableItemContext } from '../contexts'\nimport { useEntity } from '@contember/react-binding'\n\n/**\n * Iterates over all entities in the repeater and renders the children for each entity.\n * Also sets up the dnd-kit sortable context for the repeater items.\n */\nexport const RepeaterSortableEachItem = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst entities = useRepeaterSortedEntities()\n\n\treturn (\n\t\t<SortableContext items={entities} strategy={verticalListSortingStrategy}>\n\t\t\t<RepeaterEachItem>\n\t\t\t\t<RepeaterSortableEachItemInner>\n\t\t\t\t\t{children}\n\t\t\t\t</RepeaterSortableEachItemInner>\n\n\t\t\t</RepeaterEachItem>\n\t\t</SortableContext>\n\t)\n}\nconst RepeaterSortableEachItemInner = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst entity = useEntity()\n\tconst sortable = useSortable({\n\t\tid: entity.id,\n\t})\n\treturn (\n\t\t<RepeaterSortableItemContext.Provider value={sortable}>\n\t\t\t{children}\n\t\t</RepeaterSortableItemContext.Provider>\n\t)\n}\n"],"names":["this"],"mappings":";;;;;AAUO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACL,QAAM,WAAW,0BAA0B;AAG1C,SAAA,uBAAC,iBAAgB,EAAA,OAAO,UAAU,UAAU,6BAC3C,UAAC,uBAAA,kBAAA,EACA,UAAC,uBAAA,+BAAA,EACC,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAKA,EAND,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAOA,GAAAA,MAAA;AAEF;AACA,MAAM,gCAAgC,CAAC,EAAE,eAEnC;AACL,QAAM,SAAS,UAAU;AACzB,QAAM,WAAW,YAAY;AAAA,IAC5B,IAAI,OAAO;AAAA,EAAA,CACX;AACD,gCACE,4BAA4B,UAA5B,EAAqC,OAAO,UAC3C,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAA,MAAA;AAEF;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const contexts = require("../contexts.cjs");
|
|
6
|
-
const reactSlot = require("@radix-ui/react-slot");
|
|
7
|
-
const reactUtils = require("@contember/react-utils");
|
|
8
|
-
const RepeaterSortableItemActivator = React.forwardRef((props, ref) => {
|
|
9
|
-
const { setActivatorNodeRef, listeners } = contexts.useRepeaterSortableItem();
|
|
10
|
-
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactSlot.Slot, { ref: reactUtils.useComposeRef(ref, setActivatorNodeRef), ...listeners, ...props }, void 0, false, {
|
|
11
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemActivator.tsx",
|
|
12
|
-
lineNumber: 13,
|
|
13
|
-
columnNumber: 9
|
|
14
|
-
}, void 0);
|
|
15
|
-
});
|
|
16
|
-
exports.RepeaterSortableItemActivator = RepeaterSortableItemActivator;
|
|
17
|
-
//# sourceMappingURL=RepeaterSortableItemActivator.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableItemActivator.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemActivator.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useComposeRef } from '@contember/react-utils'\n\n/**\n * Slot for the repeater item activator, which is the element that triggers the drag and drop interaction (e.g. a handle).\n */\nexport const RepeaterSortableItemActivator = forwardRef<HTMLElement, {\n\tchildren: ReactElement\n}>((props, ref) => {\n\tconst { setActivatorNodeRef, listeners } = useRepeaterSortableItem()\n\treturn <Slot ref={useComposeRef(ref, setActivatorNodeRef)} {...listeners} {...props} />\n})\n"],"names":["forwardRef","useRepeaterSortableItem","jsxDEV","Slot","useComposeRef","this"],"mappings":";;;;;;;AAQO,MAAM,gCAAgCA,MAAA,WAE1C,CAAC,OAAO,QAAQ;AAClB,QAAM,EAAE,qBAAqB,UAAU,IAAIC,iCAAwB;AAC5D,SAAAC,8BAAA,OAACC,UAAK,MAAA,EAAA,KAAKC,WAAAA,cAAc,KAAK,mBAAmB,GAAI,GAAG,WAAY,GAAG,MAAvE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA8E,GAAAC,MAAA;AACtF,CAAC;;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { useRepeaterSortableItem } from "../contexts.js";
|
|
4
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
-
import { useComposeRef } from "@contember/react-utils";
|
|
6
|
-
const RepeaterSortableItemActivator = forwardRef((props, ref) => {
|
|
7
|
-
const { setActivatorNodeRef, listeners } = useRepeaterSortableItem();
|
|
8
|
-
return /* @__PURE__ */ jsxDEV(Slot, { ref: useComposeRef(ref, setActivatorNodeRef), ...listeners, ...props }, void 0, false, {
|
|
9
|
-
fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemActivator.tsx",
|
|
10
|
-
lineNumber: 13,
|
|
11
|
-
columnNumber: 9
|
|
12
|
-
}, void 0);
|
|
13
|
-
});
|
|
14
|
-
export {
|
|
15
|
-
RepeaterSortableItemActivator
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=RepeaterSortableItemActivator.js.map
|