@pie-lib/drag 4.1.3 → 5.0.0-next.20261002094057

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.
Files changed (67) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/drag-in-the-blank-dp.d.ts +29 -0
  3. package/dist/drag-in-the-blank-dp.js +44 -0
  4. package/dist/drag-provider.d.ts +41 -0
  5. package/dist/drag-provider.js +46 -0
  6. package/dist/draggable-choice.d.ts +43 -0
  7. package/dist/draggable-choice.js +63 -0
  8. package/dist/droppable-placeholder.d.ts +29 -0
  9. package/dist/droppable-placeholder.js +36 -0
  10. package/dist/ica-dp.d.ts +24 -0
  11. package/dist/ica-dp.js +20 -0
  12. package/dist/index.d.ts +17 -0
  13. package/dist/index.js +9 -0
  14. package/dist/match-list-dp.d.ts +26 -0
  15. package/dist/match-list-dp.js +21 -0
  16. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  17. package/dist/placeholder.d.ts +31 -0
  18. package/dist/placeholder.js +97 -0
  19. package/dist/swap.d.ts +10 -0
  20. package/dist/swap.js +9 -0
  21. package/dist/uid-context.d.ts +13 -0
  22. package/dist/uid-context.js +15 -0
  23. package/package.json +31 -15
  24. package/CHANGELOG.json +0 -1
  25. package/CHANGELOG.md +0 -843
  26. package/LICENSE.md +0 -5
  27. package/lib/drag-in-the-blank-dp.js +0 -66
  28. package/lib/drag-in-the-blank-dp.js.map +0 -1
  29. package/lib/drag-provider.js +0 -95
  30. package/lib/drag-provider.js.map +0 -1
  31. package/lib/drag-type.js +0 -14
  32. package/lib/drag-type.js.map +0 -1
  33. package/lib/draggable-choice.js +0 -95
  34. package/lib/draggable-choice.js.map +0 -1
  35. package/lib/droppable-placeholder.js +0 -50
  36. package/lib/droppable-placeholder.js.map +0 -1
  37. package/lib/ica-dp.js +0 -37
  38. package/lib/ica-dp.js.map +0 -1
  39. package/lib/index.js +0 -61
  40. package/lib/index.js.map +0 -1
  41. package/lib/match-list-dp.js +0 -49
  42. package/lib/match-list-dp.js.map +0 -1
  43. package/lib/placeholder.js +0 -131
  44. package/lib/placeholder.js.map +0 -1
  45. package/lib/preview-component.js +0 -154
  46. package/lib/preview-component.js.map +0 -1
  47. package/lib/swap.js +0 -18
  48. package/lib/swap.js.map +0 -1
  49. package/lib/uid-context.js +0 -26
  50. package/lib/uid-context.js.map +0 -1
  51. package/src/__tests__/drag-provider.test.jsx +0 -395
  52. package/src/__tests__/placeholder.test.jsx +0 -107
  53. package/src/__tests__/preview-component.test.jsx +0 -537
  54. package/src/__tests__/swap.test.js +0 -161
  55. package/src/__tests__/uid-context.test.jsx +0 -54
  56. package/src/drag-in-the-blank-dp.jsx +0 -65
  57. package/src/drag-provider.jsx +0 -90
  58. package/src/drag-type.js +0 -7
  59. package/src/draggable-choice.jsx +0 -83
  60. package/src/droppable-placeholder.jsx +0 -41
  61. package/src/ica-dp.jsx +0 -25
  62. package/src/index.js +0 -19
  63. package/src/match-list-dp.jsx +0 -36
  64. package/src/placeholder.jsx +0 -138
  65. package/src/preview-component.jsx +0 -145
  66. package/src/swap.js +0 -14
  67. 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 { PlaceHolder as 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 DragInTheBlankDroppable, o as default };
@@ -0,0 +1,41 @@
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, onDragCancel, collisionDetection, modifiers, autoScroll, keyboardCoordinateGetter, keyboardCodes, accessibility, }: {
12
+ children: any;
13
+ onDragEnd: any;
14
+ onDragStart: any;
15
+ onDragCancel: any;
16
+ collisionDetection: any;
17
+ modifiers: any;
18
+ autoScroll: any;
19
+ keyboardCoordinateGetter: any;
20
+ keyboardCodes: any;
21
+ accessibility: any;
22
+ }): React.JSX.Element;
23
+ export declare namespace DragProvider {
24
+ var propTypes: {
25
+ children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
26
+ onDragEnd: PropTypes.Requireable<(...args: any[]) => any>;
27
+ onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
28
+ onDragCancel: PropTypes.Requireable<(...args: any[]) => any>;
29
+ collisionDetection: PropTypes.Requireable<(...args: any[]) => any>;
30
+ modifiers: PropTypes.Requireable<(((...args: any[]) => any) | null | undefined)[]>;
31
+ autoScroll: PropTypes.Requireable<object>;
32
+ keyboardCoordinateGetter: PropTypes.Requireable<(...args: any[]) => any>;
33
+ keyboardCodes: PropTypes.Requireable<PropTypes.InferProps<{
34
+ start: PropTypes.Requireable<(string | null | undefined)[]>;
35
+ cancel: PropTypes.Requireable<(string | null | undefined)[]>;
36
+ end: PropTypes.Requireable<(string | null | undefined)[]>;
37
+ }>>;
38
+ accessibility: PropTypes.Requireable<object>;
39
+ };
40
+ }
41
+ export default DragProvider;
@@ -0,0 +1,46 @@
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, onDragCancel: u, collisionDetection: d, modifiers: f, autoScroll: p, keyboardCoordinateGetter: m, keyboardCodes: h, accessibility: g }) {
7
+ let [_, v] = e(null), y = m || h ? {
8
+ coordinateGetter: m,
9
+ keyboardCodes: h
10
+ } : void 0;
11
+ return /* @__PURE__ */ n(r, {
12
+ sensors: s(o(a, { activationConstraint: { distance: 8 } }), o(i, y)),
13
+ onDragStart: (e) => {
14
+ v(e.active.id), l && l(e);
15
+ },
16
+ onDragEnd: (e) => {
17
+ v(null), c && c(e);
18
+ },
19
+ onDragCancel: (e) => {
20
+ v(null), u && u(e);
21
+ },
22
+ collisionDetection: d,
23
+ modifiers: f,
24
+ autoScroll: p,
25
+ accessibility: g,
26
+ children: t
27
+ });
28
+ }
29
+ c.propTypes = {
30
+ children: t.node.isRequired,
31
+ onDragEnd: t.func,
32
+ onDragStart: t.func,
33
+ onDragCancel: t.func,
34
+ collisionDetection: t.func,
35
+ modifiers: t.arrayOf(t.func),
36
+ autoScroll: t.object,
37
+ keyboardCoordinateGetter: t.func,
38
+ keyboardCodes: t.shape({
39
+ start: t.arrayOf(t.string),
40
+ cancel: t.arrayOf(t.string),
41
+ end: t.arrayOf(t.string)
42
+ }),
43
+ accessibility: t.object
44
+ };
45
+ //#endregion
46
+ export { c as DragProvider, c as 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 { jsx as n } from "react/jsx-runtime";
5
+ import { useDraggable as r } from "@dnd-kit/core";
6
+ import { grey as i } from "@mui/material/colors";
7
+ //#region src/draggable-choice.tsx
8
+ var a = e("div")(({ theme: e }) => ({
9
+ backgroundColor: e.palette.background.paper,
10
+ border: `solid 1px ${i[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: i, disabled: o, category: s, alternateResponseIndex: c, choiceIndex: l, onRemoveChoice: u, type: d, id: f }) {
21
+ let { attributes: p, listeners: m, setNodeRef: h, isDragging: g } = r({
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__ */ n(a, {
39
+ ref: h,
40
+ className: i,
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 DraggableChoice, 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 { PlaceHolder as 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 DroppablePlaceholder, a as default };
@@ -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 { DroppablePlaceholder as 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 ICADroppable, r as default };
@@ -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 { PlaceHolder as e } from "./placeholder.js";
2
+ import { DraggableChoice as t } from "./draggable-choice.js";
3
+ import { DragProvider as n } from "./drag-provider.js";
4
+ import r from "./swap.js";
5
+ import { uid_context_exports as i } from "./uid-context.js";
6
+ import { MatchListDroppable as a } from "./match-list-dp.js";
7
+ import { DragInTheBlankDroppable as o } from "./drag-in-the-blank-dp.js";
8
+ import { ICADroppable as 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 { DroppablePlaceholder as 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 MatchListDroppable, 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 clsx, 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,97 @@
1
+ import { clsx as 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 { jsx as i } from "react/jsx-runtime";
7
+ //#region src/placeholder.tsx
8
+ var a = t("div")(({ theme: e }) => ({
9
+ "&.placeholder": {
10
+ WebkitTouchCallout: "none",
11
+ WebkitUserSelect: "none",
12
+ KhtmlUserSelect: "none",
13
+ MozUserSelect: "none",
14
+ MsUserSelect: "none",
15
+ userSelect: "none",
16
+ width: "100%",
17
+ height: "100%",
18
+ background: r.white(),
19
+ transition: "background-color 200ms linear, border-color 200ms linear",
20
+ boxSizing: "border-box",
21
+ display: "grid",
22
+ gridRowGap: e.spacing(1),
23
+ gridColumnGap: e.spacing(1),
24
+ padding: e.spacing(1),
25
+ border: `2px dashed ${r.black()}`
26
+ },
27
+ "&.placeholderDisabled": {
28
+ boxShadow: "none",
29
+ background: r.white()
30
+ },
31
+ "&.over": {
32
+ border: `1px solid ${r.border()}`,
33
+ backgroundColor: r.backgroundDark()
34
+ },
35
+ "&.board": {
36
+ padding: e.spacing(1),
37
+ display: "flex",
38
+ flexWrap: "wrap",
39
+ alignItems: "center",
40
+ minHeight: "100px",
41
+ justifyContent: "center",
42
+ overflow: "hidden",
43
+ touchAction: "none",
44
+ backgroundColor: r.surface()
45
+ },
46
+ "&.categorizeBoard": {
47
+ padding: e.spacing(.5),
48
+ display: "flex",
49
+ flexWrap: "wrap",
50
+ alignItems: "center",
51
+ minHeight: "100px",
52
+ justifyContent: "center",
53
+ overflow: "hidden",
54
+ touchAction: "none",
55
+ backgroundColor: r.surface()
56
+ },
57
+ "&.verticalPool": {
58
+ display: "flex",
59
+ flexFlow: "column wrap"
60
+ }
61
+ })), o = (t) => {
62
+ let { children: n, className: o, isOver: s, type: c, grid: l, disabled: u, choiceBoard: d, isCategorize: f, isVerticalPool: p, minHeight: m, extraStyles: h } = t, g = e("placeholder", u && "placeholderDisabled", s && "over", c, o), _ = {};
63
+ if (l && l.columns && (_.gridTemplateColumns = `repeat(${l.columns}, 1fr)`), l && l.rows) {
64
+ let e = l.rowsRepeatValue || "1fr";
65
+ _.gridTemplateRows = `repeat(${l.rows}, ${e})`;
66
+ }
67
+ c === "choice" && (_.border = `1px solid ${r.borderLight()}`, _.background = r.surface());
68
+ let v = f ? "categorizeBoard" : "board";
69
+ return /* @__PURE__ */ i(a, {
70
+ style: {
71
+ ..._,
72
+ minHeight: m,
73
+ ...h
74
+ },
75
+ className: e(d ? v : g, p && "verticalPool"),
76
+ children: n
77
+ });
78
+ };
79
+ o.propTypes = {
80
+ choiceBoard: n.bool,
81
+ grid: n.shape({
82
+ columns: n.number,
83
+ rows: n.number,
84
+ rowsRepeatValue: n.string
85
+ }),
86
+ children: n.oneOfType([n.arrayOf(n.node), n.node]).isRequired,
87
+ className: n.string,
88
+ isOver: n.bool,
89
+ index: n.number,
90
+ type: n.string,
91
+ disabled: n.bool,
92
+ isCategorize: n.bool,
93
+ isVerticalPool: n.bool,
94
+ minHeight: n.number
95
+ };
96
+ //#endregion
97
+ export { o as PlaceHolder, o as default };
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;
@@ -0,0 +1,15 @@
1
+ import { __exportAll as e } from "./_virtual/_rolldown/runtime.js";
2
+ import t from "react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/uid-context.tsx
5
+ var r = /* @__PURE__ */ e({
6
+ Consumer: () => i,
7
+ Provider: () => a,
8
+ generateId: () => o,
9
+ withUid: () => s
10
+ }), { Consumer: i, Provider: a } = t.createContext(-1), o = () => (Math.random() * 1000001).toFixed(0), s = (e) => (t) => /* @__PURE__ */ n(i, { children: (r) => /* @__PURE__ */ n(e, {
11
+ ...t,
12
+ uid: r
13
+ }) });
14
+ //#endregion
15
+ export { i as Consumer, a as Provider, o as generateId, r as uid_context_exports, s as withUid };