@pie-lib/drag 4.0.3-next.36 → 4.0.3-next.38
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/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/drag-in-the-blank-dp.d.ts +29 -0
- package/dist/drag-in-the-blank-dp.js +44 -0
- package/dist/drag-provider.d.ts +29 -0
- package/dist/drag-provider.js +31 -0
- package/dist/drag-type.d.ts +16 -0
- package/dist/draggable-choice.d.ts +43 -0
- package/dist/draggable-choice.js +63 -0
- package/dist/droppable-placeholder.d.ts +29 -0
- package/dist/droppable-placeholder.js +36 -0
- package/dist/ica-dp.d.ts +24 -0
- package/dist/ica-dp.js +20 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +9 -0
- package/dist/match-list-dp.d.ts +26 -0
- package/dist/match-list-dp.js +21 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/placeholder.d.ts +31 -0
- package/dist/placeholder.js +98 -0
- package/dist/preview-component.d.ts +11 -0
- package/dist/swap.d.ts +10 -0
- package/dist/swap.js +9 -0
- package/dist/uid-context.d.ts +13 -0
- package/dist/uid-context.js +15 -0
- package/package.json +33 -15
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -802
- package/LICENSE.md +0 -5
- package/lib/drag-in-the-blank-dp.js +0 -66
- package/lib/drag-in-the-blank-dp.js.map +0 -1
- package/lib/drag-provider.js +0 -61
- package/lib/drag-provider.js.map +0 -1
- package/lib/drag-type.js +0 -14
- package/lib/drag-type.js.map +0 -1
- package/lib/draggable-choice.js +0 -95
- package/lib/draggable-choice.js.map +0 -1
- package/lib/droppable-placeholder.js +0 -50
- package/lib/droppable-placeholder.js.map +0 -1
- package/lib/ica-dp.js +0 -37
- package/lib/ica-dp.js.map +0 -1
- package/lib/index.js +0 -61
- package/lib/index.js.map +0 -1
- package/lib/match-list-dp.js +0 -49
- package/lib/match-list-dp.js.map +0 -1
- package/lib/placeholder.js +0 -131
- package/lib/placeholder.js.map +0 -1
- package/lib/preview-component.js +0 -154
- package/lib/preview-component.js.map +0 -1
- package/lib/swap.js +0 -18
- package/lib/swap.js.map +0 -1
- package/lib/uid-context.js +0 -26
- package/lib/uid-context.js.map +0 -1
- package/src/__tests__/drag-provider.test.jsx +0 -313
- package/src/__tests__/placeholder.test.jsx +0 -107
- package/src/__tests__/preview-component.test.jsx +0 -537
- package/src/__tests__/swap.test.js +0 -161
- package/src/__tests__/uid-context.test.jsx +0 -54
- package/src/drag-in-the-blank-dp.jsx +0 -65
- package/src/drag-provider.jsx +0 -50
- package/src/drag-type.js +0 -7
- package/src/draggable-choice.jsx +0 -83
- package/src/droppable-placeholder.jsx +0 -41
- package/src/ica-dp.jsx +0 -25
- package/src/index.js +0 -19
- package/src/match-list-dp.jsx +0 -36
- package/src/placeholder.jsx +0 -132
- package/src/preview-component.jsx +0 -145
- package/src/swap.js +0 -14
- package/src/uid-context.js +0 -13
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.defineProperty, t = (t, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as __exportAll };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/drag-in-the-blank-dp.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare function DragInTheBlankDroppable({ children, disabled, classes, isVerticalPool, minHeight, instanceId, ...rest }: {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
children: any;
|
|
14
|
+
disabled: any;
|
|
15
|
+
classes: any;
|
|
16
|
+
isVerticalPool: any;
|
|
17
|
+
minHeight: any;
|
|
18
|
+
instanceId: any;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
export declare namespace DragInTheBlankDroppable {
|
|
21
|
+
var propTypes: {
|
|
22
|
+
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
23
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
24
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
25
|
+
onDrop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
|
+
instanceId: PropTypes.Requireable<string>;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default DragInTheBlankDroppable;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import e from "./placeholder.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { styled as t } from "@mui/material/styles";
|
|
4
|
+
import n from "prop-types";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import { useDroppable as i } from "@dnd-kit/core";
|
|
7
|
+
//#region src/drag-in-the-blank-dp.tsx
|
|
8
|
+
var a = t("div")({ minHeight: "100px" });
|
|
9
|
+
function o({ children: t, disabled: n, classes: o, isVerticalPool: s, minHeight: c, instanceId: l, ...u }) {
|
|
10
|
+
let { setNodeRef: d, isOver: f } = i({
|
|
11
|
+
id: "drag-in-the-blank-droppable",
|
|
12
|
+
data: {
|
|
13
|
+
type: "MaskBlank",
|
|
14
|
+
accepts: ["MaskBlank"],
|
|
15
|
+
id: "drag-in-the-blank-droppable",
|
|
16
|
+
toChoiceBoard: !0,
|
|
17
|
+
instanceId: l
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ r("div", {
|
|
21
|
+
ref: d,
|
|
22
|
+
children: /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(e, {
|
|
23
|
+
isOver: f,
|
|
24
|
+
choiceBoard: !0,
|
|
25
|
+
className: o,
|
|
26
|
+
isVerticalPool: s,
|
|
27
|
+
extraStyles: {
|
|
28
|
+
width: "100%",
|
|
29
|
+
minHeight: c || 100,
|
|
30
|
+
height: "auto"
|
|
31
|
+
},
|
|
32
|
+
children: t
|
|
33
|
+
}) })
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
o.propTypes = {
|
|
37
|
+
id: n.oneOfType([n.string, n.number]).isRequired,
|
|
38
|
+
children: n.node,
|
|
39
|
+
disabled: n.bool,
|
|
40
|
+
onDrop: n.func,
|
|
41
|
+
instanceId: n.string
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { o as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/drag-provider.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare function DragProvider({ children, onDragEnd, onDragStart, collisionDetection, modifiers, autoScroll }: {
|
|
12
|
+
children: any;
|
|
13
|
+
onDragEnd: any;
|
|
14
|
+
onDragStart: any;
|
|
15
|
+
collisionDetection: any;
|
|
16
|
+
modifiers: any;
|
|
17
|
+
autoScroll: any;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
export declare namespace DragProvider {
|
|
20
|
+
var propTypes: {
|
|
21
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
22
|
+
onDragEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
+
onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
+
collisionDetection: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
+
modifiers: PropTypes.Requireable<(((...args: any[]) => any) | null | undefined)[]>;
|
|
26
|
+
autoScroll: PropTypes.Requireable<object>;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default DragProvider;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { DndContext as r, KeyboardSensor as i, PointerSensor as a, useSensor as o, useSensors as s } from "@dnd-kit/core";
|
|
5
|
+
//#region src/drag-provider.tsx
|
|
6
|
+
function c({ children: t, onDragEnd: c, onDragStart: l, collisionDetection: u, modifiers: d, autoScroll: f }) {
|
|
7
|
+
let [p, m] = e(null);
|
|
8
|
+
return /* @__PURE__ */ n(r, {
|
|
9
|
+
sensors: s(o(a, { activationConstraint: { distance: 8 } }), o(i)),
|
|
10
|
+
onDragStart: (e) => {
|
|
11
|
+
m(e.active.id), l && l(e);
|
|
12
|
+
},
|
|
13
|
+
onDragEnd: (e) => {
|
|
14
|
+
m(null), c && c(e);
|
|
15
|
+
},
|
|
16
|
+
collisionDetection: u,
|
|
17
|
+
modifiers: d,
|
|
18
|
+
autoScroll: f,
|
|
19
|
+
children: t
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
c.propTypes = {
|
|
23
|
+
children: t.node.isRequired,
|
|
24
|
+
onDragEnd: t.func,
|
|
25
|
+
onDragStart: t.func,
|
|
26
|
+
collisionDetection: t.func,
|
|
27
|
+
modifiers: t.arrayOf(t.func),
|
|
28
|
+
autoScroll: t.object
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { c as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/drag-type.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: {
|
|
10
|
+
types: {
|
|
11
|
+
ica: string;
|
|
12
|
+
ml: string;
|
|
13
|
+
db: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/draggable-choice.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const DRAG_TYPE = "CHOICE";
|
|
12
|
+
export declare function DraggableChoice({ choice, children, className, disabled, category, alternateResponseIndex, choiceIndex, onRemoveChoice, type, id, }: {
|
|
13
|
+
choice: any;
|
|
14
|
+
children: any;
|
|
15
|
+
className: any;
|
|
16
|
+
disabled: any;
|
|
17
|
+
category: any;
|
|
18
|
+
alternateResponseIndex: any;
|
|
19
|
+
choiceIndex: any;
|
|
20
|
+
onRemoveChoice: any;
|
|
21
|
+
type: any;
|
|
22
|
+
id: any;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
export declare namespace DraggableChoice {
|
|
25
|
+
var propTypes: {
|
|
26
|
+
choice: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
27
|
+
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
28
|
+
value: PropTypes.Requireable<any>;
|
|
29
|
+
}>>>;
|
|
30
|
+
children: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
31
|
+
className: PropTypes.Requireable<string>;
|
|
32
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
33
|
+
category: PropTypes.Requireable<PropTypes.InferProps<{
|
|
34
|
+
id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
35
|
+
}>>;
|
|
36
|
+
alternateResponseIndex: PropTypes.Requireable<number>;
|
|
37
|
+
choiceIndex: PropTypes.Requireable<number>;
|
|
38
|
+
onRemoveChoice: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
+
type: PropTypes.Requireable<string>;
|
|
40
|
+
id: PropTypes.Requireable<string>;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export default DraggableChoice;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { styled as e } from "@mui/material/styles";
|
|
3
|
+
import t from "prop-types";
|
|
4
|
+
import { grey as n } from "@mui/material/colors";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import { useDraggable as i } from "@dnd-kit/core";
|
|
7
|
+
//#region src/draggable-choice.tsx
|
|
8
|
+
var a = e("div")(({ theme: e }) => ({
|
|
9
|
+
backgroundColor: e.palette.background.paper,
|
|
10
|
+
border: `solid 1px ${n[400]}`,
|
|
11
|
+
padding: e.spacing(1),
|
|
12
|
+
minHeight: "30px",
|
|
13
|
+
minWidth: e.spacing(20),
|
|
14
|
+
maxWidth: e.spacing(75),
|
|
15
|
+
cursor: "grab",
|
|
16
|
+
"& p": { margin: 0 },
|
|
17
|
+
"& p *": { margin: 0 },
|
|
18
|
+
"&:active": { cursor: "grabbing" }
|
|
19
|
+
}));
|
|
20
|
+
function o({ choice: e, children: t, className: n, disabled: o, category: s, alternateResponseIndex: c, choiceIndex: l, onRemoveChoice: u, type: d, id: f }) {
|
|
21
|
+
let { attributes: p, listeners: m, setNodeRef: h, isDragging: g } = i({
|
|
22
|
+
id: f || e.id,
|
|
23
|
+
disabled: o,
|
|
24
|
+
categoryId: s?.id,
|
|
25
|
+
alternateResponseIndex: c,
|
|
26
|
+
data: {
|
|
27
|
+
id: e.id,
|
|
28
|
+
value: e.value,
|
|
29
|
+
choiceId: e.id,
|
|
30
|
+
from: s?.id,
|
|
31
|
+
categoryId: s?.id,
|
|
32
|
+
alternateResponseIndex: c,
|
|
33
|
+
choiceIndex: l,
|
|
34
|
+
onRemoveChoice: u,
|
|
35
|
+
type: d
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ r(a, {
|
|
39
|
+
ref: h,
|
|
40
|
+
className: n,
|
|
41
|
+
isDragging: g,
|
|
42
|
+
...p,
|
|
43
|
+
...m,
|
|
44
|
+
children: t
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
o.propTypes = {
|
|
48
|
+
choice: t.shape({
|
|
49
|
+
id: t.oneOfType([t.string, t.number]).isRequired,
|
|
50
|
+
value: t.any
|
|
51
|
+
}).isRequired,
|
|
52
|
+
children: t.oneOfType([t.arrayOf(t.node), t.node]),
|
|
53
|
+
className: t.string,
|
|
54
|
+
disabled: t.bool,
|
|
55
|
+
category: t.shape({ id: t.oneOfType([t.string, t.number]) }),
|
|
56
|
+
alternateResponseIndex: t.number,
|
|
57
|
+
choiceIndex: t.number,
|
|
58
|
+
onRemoveChoice: t.func,
|
|
59
|
+
type: t.string,
|
|
60
|
+
id: t.string
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { o as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/droppable-placeholder.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare function DroppablePlaceholder({ id, children, disabled, classes, isVerticalPool, minHeight }: {
|
|
12
|
+
id: any;
|
|
13
|
+
children: any;
|
|
14
|
+
disabled: any;
|
|
15
|
+
classes: any;
|
|
16
|
+
isVerticalPool: any;
|
|
17
|
+
minHeight: any;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
export declare namespace DroppablePlaceholder {
|
|
20
|
+
var propTypes: {
|
|
21
|
+
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
22
|
+
children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
|
|
23
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
24
|
+
classes: PropTypes.Requireable<object>;
|
|
25
|
+
isVerticalPool: PropTypes.Requireable<boolean>;
|
|
26
|
+
minHeight: PropTypes.Requireable<number>;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default DroppablePlaceholder;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import e from "./placeholder.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import t from "prop-types";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { useDroppable as r } from "@dnd-kit/core";
|
|
6
|
+
//#region src/droppable-placeholder.tsx
|
|
7
|
+
var i = { flex: 1 };
|
|
8
|
+
function a({ id: t, children: a, disabled: o, classes: s, isVerticalPool: c, minHeight: l }) {
|
|
9
|
+
let { setNodeRef: u, isOver: d } = r({
|
|
10
|
+
id: t,
|
|
11
|
+
disabled: o
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ n("div", {
|
|
14
|
+
ref: u,
|
|
15
|
+
style: i,
|
|
16
|
+
children: /* @__PURE__ */ n(e, {
|
|
17
|
+
disabled: o,
|
|
18
|
+
isOver: d,
|
|
19
|
+
choiceBoard: !0,
|
|
20
|
+
className: s,
|
|
21
|
+
isVerticalPool: c,
|
|
22
|
+
minHeight: l,
|
|
23
|
+
children: a
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
a.propTypes = {
|
|
28
|
+
id: t.oneOfType([t.string, t.number]).isRequired,
|
|
29
|
+
children: t.oneOfType([t.arrayOf(t.node), t.node]).isRequired,
|
|
30
|
+
disabled: t.bool,
|
|
31
|
+
classes: t.object,
|
|
32
|
+
isVerticalPool: t.bool,
|
|
33
|
+
minHeight: t.number
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { a as default };
|
package/dist/ica-dp.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/ica-dp.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare function ICADroppable({ id, children, disabled, ...rest }: {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
id: any;
|
|
14
|
+
children: any;
|
|
15
|
+
disabled: any;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
export declare namespace ICADroppable {
|
|
18
|
+
var propTypes: {
|
|
19
|
+
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
20
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
21
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default ICADroppable;
|
package/dist/ica-dp.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import e from "./droppable-placeholder.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import t from "prop-types";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/ica-dp.tsx
|
|
6
|
+
function r({ id: t, children: r, disabled: i, ...a }) {
|
|
7
|
+
return /* @__PURE__ */ n(e, {
|
|
8
|
+
id: t,
|
|
9
|
+
disabled: i,
|
|
10
|
+
...a,
|
|
11
|
+
children: r
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
r.propTypes = {
|
|
15
|
+
id: t.oneOfType([t.string, t.number]).isRequired,
|
|
16
|
+
children: t.node,
|
|
17
|
+
disabled: t.bool
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { r as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/index.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import PlaceHolder from './placeholder.js';
|
|
10
|
+
import DraggableChoice from './draggable-choice.js';
|
|
11
|
+
import DragProvider from './drag-provider.js';
|
|
12
|
+
import swap from './swap.js';
|
|
13
|
+
import * as uid from './uid-context.js';
|
|
14
|
+
import MatchDroppablePlaceholder from './match-list-dp.js';
|
|
15
|
+
import DragDroppablePlaceholder from './drag-in-the-blank-dp.js';
|
|
16
|
+
import ICADroppablePlaceholder from './ica-dp.js';
|
|
17
|
+
export { PlaceHolder, MatchDroppablePlaceholder, DragDroppablePlaceholder, ICADroppablePlaceholder, DragProvider, DraggableChoice, swap, uid, };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import e from "./placeholder.js";
|
|
2
|
+
import t from "./draggable-choice.js";
|
|
3
|
+
import n from "./drag-provider.js";
|
|
4
|
+
import r from "./swap.js";
|
|
5
|
+
import { uid_context_exports as i } from "./uid-context.js";
|
|
6
|
+
import a from "./match-list-dp.js";
|
|
7
|
+
import o from "./drag-in-the-blank-dp.js";
|
|
8
|
+
import s from "./ica-dp.js";
|
|
9
|
+
export { o as DragDroppablePlaceholder, n as DragProvider, t as DraggableChoice, s as ICADroppablePlaceholder, a as MatchDroppablePlaceholder, e as PlaceHolder, r as swap, i as uid };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/match-list-dp.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare function MatchListDroppable({ id, children, disabled, onRemoveAnswer, ...rest }: {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
id: any;
|
|
14
|
+
children: any;
|
|
15
|
+
disabled: any;
|
|
16
|
+
onRemoveAnswer: any;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
export declare namespace MatchListDroppable {
|
|
19
|
+
var propTypes: {
|
|
20
|
+
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
21
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
22
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
23
|
+
onRemoveAnswer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export default MatchListDroppable;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import e from "./droppable-placeholder.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import t from "prop-types";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/match-list-dp.tsx
|
|
6
|
+
function r({ id: t, children: r, disabled: i, onRemoveAnswer: a, ...o }) {
|
|
7
|
+
return /* @__PURE__ */ n(e, {
|
|
8
|
+
id: t,
|
|
9
|
+
disabled: i,
|
|
10
|
+
...o,
|
|
11
|
+
children: r
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
r.propTypes = {
|
|
15
|
+
id: t.oneOfType([t.string, t.number]).isRequired,
|
|
16
|
+
children: t.node,
|
|
17
|
+
disabled: t.bool,
|
|
18
|
+
onRemoveAnswer: t.func
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { r as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
2
|
+
function e(t) {
|
|
3
|
+
var n, r, i = "";
|
|
4
|
+
if (typeof t == "string" || typeof t == "number") i += t;
|
|
5
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
6
|
+
var a = t.length;
|
|
7
|
+
for (n = 0; n < a; n++) t[n] && (r = e(t[n])) && (i && (i += " "), i += r);
|
|
8
|
+
} else for (r in t) t[r] && (i && (i += " "), i += r);
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
function t() {
|
|
12
|
+
for (var t, n, r = 0, i = "", a = arguments.length; r < a; r++) (t = arguments[r]) && (n = e(t)) && (i && (i += " "), i += n);
|
|
13
|
+
return i;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { t as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/placeholder.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const PlaceHolder: {
|
|
12
|
+
(props: any): React.JSX.Element;
|
|
13
|
+
propTypes: {
|
|
14
|
+
choiceBoard: PropTypes.Requireable<boolean>;
|
|
15
|
+
grid: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
+
columns: PropTypes.Requireable<number>;
|
|
17
|
+
rows: PropTypes.Requireable<number>;
|
|
18
|
+
rowsRepeatValue: PropTypes.Requireable<string>;
|
|
19
|
+
}>>;
|
|
20
|
+
children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
|
|
21
|
+
className: PropTypes.Requireable<string>;
|
|
22
|
+
isOver: PropTypes.Requireable<boolean>;
|
|
23
|
+
index: PropTypes.Requireable<number>;
|
|
24
|
+
type: PropTypes.Requireable<string>;
|
|
25
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
26
|
+
isCategorize: PropTypes.Requireable<boolean>;
|
|
27
|
+
isVerticalPool: PropTypes.Requireable<boolean>;
|
|
28
|
+
minHeight: PropTypes.Requireable<number>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export default PlaceHolder;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import e from "./node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { styled as t } from "@mui/material/styles";
|
|
4
|
+
import n from "prop-types";
|
|
5
|
+
import { color as r } from "@pie-lib/render-ui";
|
|
6
|
+
import { grey as i } from "@mui/material/colors";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
|
+
//#region src/placeholder.tsx
|
|
9
|
+
var o = t("div")(({ theme: e }) => ({
|
|
10
|
+
"&.placeholder": {
|
|
11
|
+
WebkitTouchCallout: "none",
|
|
12
|
+
WebkitUserSelect: "none",
|
|
13
|
+
KhtmlUserSelect: "none",
|
|
14
|
+
MozUserSelect: "none",
|
|
15
|
+
MsUserSelect: "none",
|
|
16
|
+
userSelect: "none",
|
|
17
|
+
width: "100%",
|
|
18
|
+
height: "100%",
|
|
19
|
+
background: r.white(),
|
|
20
|
+
transition: "background-color 200ms linear, border-color 200ms linear",
|
|
21
|
+
boxSizing: "border-box",
|
|
22
|
+
display: "grid",
|
|
23
|
+
gridRowGap: e.spacing(1),
|
|
24
|
+
gridColumnGap: e.spacing(1),
|
|
25
|
+
padding: e.spacing(1),
|
|
26
|
+
border: `2px dashed ${r.black()}`
|
|
27
|
+
},
|
|
28
|
+
"&.disabled": {
|
|
29
|
+
boxShadow: "none",
|
|
30
|
+
background: e.palette.background.paper
|
|
31
|
+
},
|
|
32
|
+
"&.over": {
|
|
33
|
+
border: `1px solid ${i[500]}`,
|
|
34
|
+
backgroundColor: `${i[300]}`
|
|
35
|
+
},
|
|
36
|
+
"&.board": {
|
|
37
|
+
padding: e.spacing(1),
|
|
38
|
+
display: "flex",
|
|
39
|
+
flexWrap: "wrap",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
minHeight: "100px",
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
touchAction: "none",
|
|
45
|
+
backgroundColor: r.backgroundDark()
|
|
46
|
+
},
|
|
47
|
+
"&.categorizeBoard": {
|
|
48
|
+
padding: e.spacing(.5),
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexWrap: "wrap",
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
minHeight: "100px",
|
|
53
|
+
justifyContent: "center",
|
|
54
|
+
overflow: "hidden",
|
|
55
|
+
touchAction: "none",
|
|
56
|
+
backgroundColor: r.backgroundDark()
|
|
57
|
+
},
|
|
58
|
+
"&.verticalPool": {
|
|
59
|
+
display: "flex",
|
|
60
|
+
flexFlow: "column wrap"
|
|
61
|
+
}
|
|
62
|
+
})), s = (t) => {
|
|
63
|
+
let { children: n, className: i, isOver: s, type: c, grid: l, disabled: u, choiceBoard: d, isCategorize: f, isVerticalPool: p, minHeight: m, extraStyles: h } = t, g = e("placeholder", u && "disabled", s && "over", c, i), _ = {};
|
|
64
|
+
if (l && l.columns && (_.gridTemplateColumns = `repeat(${l.columns}, 1fr)`), l && l.rows) {
|
|
65
|
+
let e = l.rowsRepeatValue || "1fr";
|
|
66
|
+
_.gridTemplateRows = `repeat(${l.rows}, ${e})`;
|
|
67
|
+
}
|
|
68
|
+
c === "choice" && (_.border = `1px solid ${r.borderLight()}`, _.background = r.backgroundDark());
|
|
69
|
+
let v = f ? "categorizeBoard" : "board";
|
|
70
|
+
return /* @__PURE__ */ a(o, {
|
|
71
|
+
style: {
|
|
72
|
+
..._,
|
|
73
|
+
minHeight: m,
|
|
74
|
+
...h
|
|
75
|
+
},
|
|
76
|
+
className: e(d ? v : g, p && "verticalPool"),
|
|
77
|
+
children: n
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
s.propTypes = {
|
|
81
|
+
choiceBoard: n.bool,
|
|
82
|
+
grid: n.shape({
|
|
83
|
+
columns: n.number,
|
|
84
|
+
rows: n.number,
|
|
85
|
+
rowsRepeatValue: n.string
|
|
86
|
+
}),
|
|
87
|
+
children: n.oneOfType([n.arrayOf(n.node), n.node]).isRequired,
|
|
88
|
+
className: n.string,
|
|
89
|
+
isOver: n.bool,
|
|
90
|
+
index: n.number,
|
|
91
|
+
type: n.string,
|
|
92
|
+
disabled: n.bool,
|
|
93
|
+
isCategorize: n.bool,
|
|
94
|
+
isVerticalPool: n.bool,
|
|
95
|
+
minHeight: n.number
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { s as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/preview-component.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
declare const PreviewComponent: () => React.JSX.Element;
|
|
11
|
+
export default PreviewComponent;
|
package/dist/swap.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/swap.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: (arr: any, fromIndex: any, toIndex: any) => any;
|
|
10
|
+
export default _default;
|
package/dist/swap.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { cloneDeep as e } from "@pie-element/shared-lodash";
|
|
2
|
+
//#region src/swap.ts
|
|
3
|
+
var t = (t, n, r) => {
|
|
4
|
+
if (!t || t.length <= 1 || n === void 0 || r === void 0) throw Error(`swap requires a non-empty array, fromIndex, toIndex: ${t}, ${n} ${r}`);
|
|
5
|
+
let i = e(t), a = t[r];
|
|
6
|
+
return i[r] = i[n], i[n] = a, i;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/drag/src/uid-context.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
declare const Consumer: React.Consumer<number>, Provider: React.Provider<number>;
|
|
11
|
+
export { Provider, Consumer };
|
|
12
|
+
export declare const generateId: () => string;
|
|
13
|
+
export declare const withUid: (Component: any) => (props: any) => React.JSX.Element;
|