@patternfly/react-drag-drop 5.0.0-alpha.0 → 5.2.0-prerelease.1

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 (166) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/dist/cjs.tsbuildinfo +1 -1
  4. package/dist/esm/index.d.ts +1 -1
  5. package/dist/esm/index.d.ts.map +1 -1
  6. package/dist/esm/index.js +1 -1
  7. package/dist/esm/index.js.map +1 -1
  8. package/dist/esm/next/components/DragDrop/DragButton.d.ts.map +1 -0
  9. package/dist/esm/{components → next/components}/DragDrop/DragButton.js +3 -2
  10. package/dist/esm/next/components/DragDrop/DragButton.js.map +1 -0
  11. package/dist/esm/{components → next/components}/DragDrop/DragDropSort.d.ts +12 -11
  12. package/dist/esm/next/components/DragDrop/DragDropSort.d.ts.map +1 -0
  13. package/dist/esm/next/components/DragDrop/DragDropSort.js +70 -0
  14. package/dist/esm/next/components/DragDrop/DragDropSort.js.map +1 -0
  15. package/dist/esm/next/components/DragDrop/DragDropUtil.d.ts +10 -0
  16. package/dist/esm/next/components/DragDrop/DragDropUtil.d.ts.map +1 -0
  17. package/dist/esm/next/components/DragDrop/DragDropUtil.js +2 -0
  18. package/dist/esm/next/components/DragDrop/DragDropUtil.js.map +1 -0
  19. package/dist/{js → esm/next}/components/DragDrop/Draggable.d.ts +2 -4
  20. package/dist/esm/next/components/DragDrop/Draggable.d.ts.map +1 -0
  21. package/dist/esm/{components → next/components}/DragDrop/Draggable.js +4 -4
  22. package/dist/esm/next/components/DragDrop/Draggable.js.map +1 -0
  23. package/dist/{js → esm/next}/components/DragDrop/DraggableDataListItem.d.ts +1 -3
  24. package/dist/esm/next/components/DragDrop/DraggableDataListItem.d.ts.map +1 -0
  25. package/dist/esm/{components → next/components}/DragDrop/DraggableDataListItem.js +4 -3
  26. package/dist/esm/next/components/DragDrop/DraggableDataListItem.js.map +1 -0
  27. package/dist/esm/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.d.ts +1 -5
  28. package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +1 -0
  29. package/dist/esm/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.js +7 -5
  30. package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -0
  31. package/dist/esm/next/components/DragDrop/Droppable.d.ts.map +1 -0
  32. package/dist/esm/next/components/DragDrop/Droppable.js.map +1 -0
  33. package/dist/esm/next/components/DragDrop/DroppableContext.d.ts.map +1 -0
  34. package/dist/esm/next/components/DragDrop/DroppableContext.js.map +1 -0
  35. package/dist/esm/next/components/DragDrop/index.d.ts +3 -0
  36. package/dist/esm/next/components/DragDrop/index.d.ts.map +1 -0
  37. package/dist/esm/next/components/DragDrop/index.js +3 -0
  38. package/dist/esm/next/components/DragDrop/index.js.map +1 -0
  39. package/dist/esm/next/components/index.d.ts.map +1 -0
  40. package/dist/esm/next/components/index.js.map +1 -0
  41. package/dist/esm/next/index.d.ts +2 -0
  42. package/dist/esm/next/index.d.ts.map +1 -0
  43. package/dist/esm/next/index.js +2 -0
  44. package/dist/esm/next/index.js.map +1 -0
  45. package/dist/esm.tsbuildinfo +1 -1
  46. package/dist/js/index.d.ts +1 -1
  47. package/dist/js/index.d.ts.map +1 -1
  48. package/dist/js/index.js +1 -1
  49. package/dist/js/index.js.map +1 -1
  50. package/dist/js/next/components/DragDrop/DragButton.d.ts.map +1 -0
  51. package/dist/js/{components → next/components}/DragDrop/DragButton.js +2 -1
  52. package/dist/js/next/components/DragDrop/DragButton.js.map +1 -0
  53. package/dist/js/{components → next/components}/DragDrop/DragDropSort.d.ts +12 -11
  54. package/dist/js/next/components/DragDrop/DragDropSort.d.ts.map +1 -0
  55. package/dist/js/next/components/DragDrop/DragDropSort.js +74 -0
  56. package/dist/js/next/components/DragDrop/DragDropSort.js.map +1 -0
  57. package/dist/js/next/components/DragDrop/DragDropUtil.d.ts +10 -0
  58. package/dist/js/next/components/DragDrop/DragDropUtil.d.ts.map +1 -0
  59. package/dist/js/next/components/DragDrop/DragDropUtil.js +3 -0
  60. package/dist/js/next/components/DragDrop/DragDropUtil.js.map +1 -0
  61. package/dist/{esm → js/next}/components/DragDrop/Draggable.d.ts +2 -4
  62. package/dist/js/next/components/DragDrop/Draggable.d.ts.map +1 -0
  63. package/dist/js/{components → next/components}/DragDrop/Draggable.js +3 -3
  64. package/dist/js/next/components/DragDrop/Draggable.js.map +1 -0
  65. package/dist/{esm → js/next}/components/DragDrop/DraggableDataListItem.d.ts +1 -3
  66. package/dist/js/next/components/DragDrop/DraggableDataListItem.d.ts.map +1 -0
  67. package/dist/js/{components → next/components}/DragDrop/DraggableDataListItem.js +3 -2
  68. package/dist/js/next/components/DragDrop/DraggableDataListItem.js.map +1 -0
  69. package/dist/js/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.d.ts +1 -5
  70. package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +1 -0
  71. package/dist/js/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.js +7 -5
  72. package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -0
  73. package/dist/js/next/components/DragDrop/Droppable.d.ts.map +1 -0
  74. package/dist/js/next/components/DragDrop/Droppable.js.map +1 -0
  75. package/dist/js/next/components/DragDrop/DroppableContext.d.ts.map +1 -0
  76. package/dist/js/next/components/DragDrop/DroppableContext.js.map +1 -0
  77. package/dist/js/next/components/DragDrop/index.d.ts +3 -0
  78. package/dist/js/next/components/DragDrop/index.d.ts.map +1 -0
  79. package/dist/js/{components → next/components}/DragDrop/index.js +1 -0
  80. package/dist/js/next/components/DragDrop/index.js.map +1 -0
  81. package/dist/js/next/components/index.d.ts.map +1 -0
  82. package/dist/js/next/components/index.js.map +1 -0
  83. package/dist/js/next/index.d.ts +2 -0
  84. package/dist/js/next/index.d.ts.map +1 -0
  85. package/dist/js/next/index.js +5 -0
  86. package/dist/js/next/index.js.map +1 -0
  87. package/package.json +10 -10
  88. package/src/index.ts +1 -1
  89. package/src/{components → next/components}/DragDrop/DragButton.tsx +6 -1
  90. package/src/next/components/DragDrop/DragDropSort.tsx +174 -0
  91. package/src/next/components/DragDrop/DragDropUtil.tsx +8 -0
  92. package/src/{components → next/components}/DragDrop/Draggable.tsx +10 -7
  93. package/src/{components → next/components}/DragDrop/DraggableDataListItem.tsx +15 -5
  94. package/src/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.tsx +14 -11
  95. package/src/{components → next/components}/DragDrop/__tests__/DragDrop.test.tsx +1 -1
  96. package/src/{components → next/components}/DragDrop/__tests__/__snapshots__/DragDrop.test.tsx.snap +31 -29
  97. package/src/next/components/DragDrop/examples/BasicSorting.tsx +19 -0
  98. package/src/next/components/DragDrop/examples/BasicSortingWithDragButton.tsx +20 -0
  99. package/src/{components → next/components}/DragDrop/examples/DataListDraggable.tsx +11 -19
  100. package/src/next/components/DragDrop/examples/DragDrop.md +32 -0
  101. package/src/next/components/DragDrop/examples/DragDropDemos.md +37 -0
  102. package/src/{components → next/components}/DragDrop/examples/DualListSelectorDraggable.tsx +52 -72
  103. package/src/{components → next/components}/DragDrop/index.ts +1 -0
  104. package/src/next/index.ts +1 -0
  105. package/dist/esm/components/DragDrop/DragButton.d.ts.map +0 -1
  106. package/dist/esm/components/DragDrop/DragButton.js.map +0 -1
  107. package/dist/esm/components/DragDrop/DragDropSort.d.ts.map +0 -1
  108. package/dist/esm/components/DragDrop/DragDropSort.js +0 -45
  109. package/dist/esm/components/DragDrop/DragDropSort.js.map +0 -1
  110. package/dist/esm/components/DragDrop/Draggable.d.ts.map +0 -1
  111. package/dist/esm/components/DragDrop/Draggable.js.map +0 -1
  112. package/dist/esm/components/DragDrop/DraggableDataListItem.d.ts.map +0 -1
  113. package/dist/esm/components/DragDrop/DraggableDataListItem.js.map +0 -1
  114. package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +0 -1
  115. package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.js.map +0 -1
  116. package/dist/esm/components/DragDrop/Droppable.d.ts.map +0 -1
  117. package/dist/esm/components/DragDrop/Droppable.js.map +0 -1
  118. package/dist/esm/components/DragDrop/DroppableContext.d.ts.map +0 -1
  119. package/dist/esm/components/DragDrop/DroppableContext.js.map +0 -1
  120. package/dist/esm/components/DragDrop/index.d.ts +0 -2
  121. package/dist/esm/components/DragDrop/index.d.ts.map +0 -1
  122. package/dist/esm/components/DragDrop/index.js +0 -2
  123. package/dist/esm/components/DragDrop/index.js.map +0 -1
  124. package/dist/esm/components/index.d.ts.map +0 -1
  125. package/dist/esm/components/index.js.map +0 -1
  126. package/dist/js/components/DragDrop/DragButton.d.ts.map +0 -1
  127. package/dist/js/components/DragDrop/DragButton.js.map +0 -1
  128. package/dist/js/components/DragDrop/DragDropSort.d.ts.map +0 -1
  129. package/dist/js/components/DragDrop/DragDropSort.js +0 -50
  130. package/dist/js/components/DragDrop/DragDropSort.js.map +0 -1
  131. package/dist/js/components/DragDrop/Draggable.d.ts.map +0 -1
  132. package/dist/js/components/DragDrop/Draggable.js.map +0 -1
  133. package/dist/js/components/DragDrop/DraggableDataListItem.d.ts.map +0 -1
  134. package/dist/js/components/DragDrop/DraggableDataListItem.js.map +0 -1
  135. package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +0 -1
  136. package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.js.map +0 -1
  137. package/dist/js/components/DragDrop/Droppable.d.ts.map +0 -1
  138. package/dist/js/components/DragDrop/Droppable.js.map +0 -1
  139. package/dist/js/components/DragDrop/DroppableContext.d.ts.map +0 -1
  140. package/dist/js/components/DragDrop/DroppableContext.js.map +0 -1
  141. package/dist/js/components/DragDrop/index.d.ts +0 -2
  142. package/dist/js/components/DragDrop/index.d.ts.map +0 -1
  143. package/dist/js/components/DragDrop/index.js.map +0 -1
  144. package/dist/js/components/index.d.ts.map +0 -1
  145. package/dist/js/components/index.js.map +0 -1
  146. package/src/components/DragDrop/DragDropSort.tsx +0 -123
  147. package/src/components/DragDrop/examples/BasicSorting.tsx +0 -24
  148. package/src/components/DragDrop/examples/BasicSortingWithDragButton.tsx +0 -25
  149. package/src/components/DragDrop/examples/DragDrop.md +0 -57
  150. /package/dist/esm/{components → next/components}/DragDrop/DragButton.d.ts +0 -0
  151. /package/dist/esm/{components → next/components}/DragDrop/Droppable.d.ts +0 -0
  152. /package/dist/esm/{components → next/components}/DragDrop/Droppable.js +0 -0
  153. /package/dist/esm/{components → next/components}/DragDrop/DroppableContext.d.ts +0 -0
  154. /package/dist/esm/{components → next/components}/DragDrop/DroppableContext.js +0 -0
  155. /package/dist/esm/{components → next/components}/index.d.ts +0 -0
  156. /package/dist/esm/{components → next/components}/index.js +0 -0
  157. /package/dist/js/{components → next/components}/DragDrop/DragButton.d.ts +0 -0
  158. /package/dist/js/{components → next/components}/DragDrop/Droppable.d.ts +0 -0
  159. /package/dist/js/{components → next/components}/DragDrop/Droppable.js +0 -0
  160. /package/dist/js/{components → next/components}/DragDrop/DroppableContext.d.ts +0 -0
  161. /package/dist/js/{components → next/components}/DragDrop/DroppableContext.js +0 -0
  162. /package/dist/js/{components → next/components}/index.d.ts +0 -0
  163. /package/dist/js/{components → next/components}/index.js +0 -0
  164. /package/src/{components → next/components}/DragDrop/Droppable.tsx +0 -0
  165. /package/src/{components → next/components}/DragDrop/DroppableContext.ts +0 -0
  166. /package/src/{components → next/components}/index.ts +0 -0
@@ -1,2 +1,2 @@
1
- export * from './components';
1
+ export * from './next';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from './components';
1
+ export * from './next';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragButton.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IACzE,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAU/D,CAAC"}
@@ -1,11 +1,12 @@
1
1
  import { __rest } from "tslib";
2
2
  import * as React from 'react';
3
3
  import { css } from '@patternfly/react-styles';
4
- import dragButtonStyles from '@patternfly/react-styles/css/components/DataList/data-list';
4
+ import dragButtonStyles from '@patternfly/react-styles/css/components/DataList/data-list.mjs';
5
+ import buttonStyles from '@patternfly/react-styles/css/components/Button/button.mjs';
5
6
  import GripVerticalIcon from '@patternfly/react-icons/dist/esm/icons/grip-vertical-icon';
6
7
  export const DragButton = (_a) => {
7
8
  var { className } = _a, props = __rest(_a, ["className"]);
8
- return (React.createElement("button", Object.assign({ className: css(className, 'pf-c-button', 'pf-m-plain') }, props),
9
+ return (React.createElement("button", Object.assign({ className: css(className, buttonStyles.button, buttonStyles.modifiers.plain), "aria-label": "Drag button" }, props),
9
10
  React.createElement("span", { className: css(dragButtonStyles.dataListItemDraggableIcon) },
10
11
  React.createElement(GripVerticalIcon, null))));
11
12
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragButton.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,gBAAgB,uEAAmE;AAC1F,OAAO,YAAY,kEAA8D;AACjF,OAAO,gBAAgB,MAAM,2DAA2D,CAAC;AAWzF,MAAM,CAAC,MAAM,UAAU,GAA6C,CAAC,EAAwC,EAAE,EAAE;QAA5C,EAAE,SAAS,OAA6B,EAAxB,KAAK,cAArB,aAAuB,CAAF;IAAwB,OAAA,CAChH,8CACE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,gBACjE,aAAa,IACpB,KAAK;QAET,8BAAM,SAAS,EAAE,GAAG,CAAC,gBAAgB,CAAC,yBAAyB,CAAC;YAC9D,oBAAC,gBAAgB,OAAG,CACf,CACA,CACV,CAAA;CAAA,CAAC;AACF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
@@ -1,20 +1,21 @@
1
1
  import * as React from 'react';
2
- import { DndContextProps } from '@dnd-kit/core';
3
- export interface DraggableObject {
4
- /** Unique id of the draggable object */
5
- id: string;
6
- /** Content rendered in the draggable object */
7
- content: React.ReactNode;
8
- /** Props spread to the rendered wrapper of the draggable object */
9
- props?: any;
10
- }
2
+ import { DndContextProps, DragEndEvent, DragStartEvent } from '@dnd-kit/core';
3
+ import { DraggableObject } from './DragDropUtil';
4
+ export declare type DragDropSortDragEndEvent = DragEndEvent;
5
+ export declare type DragDropSortDragStartEvent = DragStartEvent;
6
+ /**
7
+ * DragDropSortProps extends dnd-kit's props which may be viewed at https://docs.dndkit.com/api-documentation/context-provider#props.
8
+ */
11
9
  export interface DragDropSortProps extends DndContextProps {
10
+ /** Custom defined content wrapper for draggable items. By default, draggable items are wrapped in a styled div.
11
+ * Intended to be a 'DataList' or 'DualListSelectorList' without children. */
12
+ children?: React.ReactElement;
12
13
  /** Sorted array of draggable objects */
13
14
  items: DraggableObject[];
14
15
  /** Callback when user drops a draggable object */
15
- onDrop: (items: DraggableObject[], oldIndex?: number, newIndex?: number) => void;
16
+ onDrop: (event: DragDropSortDragEndEvent, items: DraggableObject[], oldIndex?: number, newIndex?: number) => void;
16
17
  /** Callback when use begins dragging a draggable object */
17
- onDrag?: (oldIndex: number) => void;
18
+ onDrag?: (event: DragDropSortDragStartEvent, oldIndex: number) => void;
18
19
  /** The variant determines which component wraps the draggable object.
19
20
  * Default and defaultWithHandle varaints wrap the draggable object in a div.
20
21
  * DataList vairant wraps the draggable object in a DataListItem
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragDropSort.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropSort.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAIL,eAAe,EAKf,YAAY,EACZ,cAAc,EACf,MAAM,eAAe,CAAC;AAUvB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,oBAAY,wBAAwB,GAAG,YAAY,CAAC;AACpD,oBAAY,0BAA0B,GAAG,cAAc,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;iFAC6E;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC9B,wCAAwC;IACxC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,kDAAkD;IAClD,MAAM,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClH,2DAA2D;IAC3D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE;;;;;SAKK;IACL,OAAO,CAAC,EAAE,SAAS,GAAG,mBAAmB,GAAG,UAAU,GAAG,sBAAsB,GAAG,iBAAiB,CAAC;CACrG;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAyHnE,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import { css } from '@patternfly/react-styles';
4
+ import { DndContext, closestCenter, DragOverlay, KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
5
+ import { arrayMove, SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from '@dnd-kit/sortable';
6
+ import { Draggable } from './Draggable';
7
+ import { DraggableDataListItem } from './DraggableDataListItem';
8
+ import { DraggableDualListSelectorListItem } from './DraggableDualListSelectorListItem';
9
+ import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop.mjs';
10
+ export const DragDropSort = (_a) => {
11
+ var { items, onDrop = () => { }, onDrag = () => { }, variant = 'default', children } = _a, props = __rest(_a, ["items", "onDrop", "onDrag", "variant", "children"]);
12
+ const [activeId, setActiveId] = React.useState(null);
13
+ const itemIds = React.useMemo(() => (items ? Array.from(items, (item) => item.id) : []), [items]);
14
+ const getItemById = (id) => items.find((item) => item.id === id);
15
+ const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
16
+ coordinateGetter: sortableKeyboardCoordinates
17
+ }));
18
+ const handleDragEnd = (event) => {
19
+ const { active, over } = event;
20
+ const oldIndex = itemIds.indexOf(active.id);
21
+ const newIndex = itemIds.indexOf(over.id);
22
+ const newItems = arrayMove(items, oldIndex, newIndex);
23
+ onDrop(event, newItems, oldIndex, newIndex);
24
+ setActiveId(null);
25
+ };
26
+ const handleDragStart = (event) => {
27
+ setActiveId(event.active.id);
28
+ onDrag(event, itemIds.indexOf(event.active.id));
29
+ };
30
+ const getDragOverlay = () => {
31
+ if (!activeId) {
32
+ return;
33
+ }
34
+ const item = getItemById(activeId);
35
+ let content;
36
+ switch (variant) {
37
+ case 'DualListSelectorList':
38
+ content = (React.createElement(DraggableDualListSelectorListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
39
+ break;
40
+ case 'DataList':
41
+ content = (React.createElement(DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
42
+ break;
43
+ default:
44
+ content = (React.createElement(Draggable, Object.assign({ useDragButton: variant === 'defaultWithHandle', key: item.id, id: item.id }, item.props), item.content));
45
+ }
46
+ return (React.createElement("div", { className: css(styles.draggable, styles.modifiers.dragging), style: {
47
+ '--pf-v5-c-draggable--m-dragging--BackgroundColor': 'var(--pf-v5-global--BackgroundColor--100)'
48
+ } }, content));
49
+ };
50
+ const renderedChildren = (React.createElement(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy, id: "droppable" },
51
+ items.map((item) => {
52
+ switch (variant) {
53
+ case 'DualListSelectorList':
54
+ return (React.createElement(DraggableDualListSelectorListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
55
+ case 'DataList':
56
+ return (React.createElement(DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
57
+ default:
58
+ return (React.createElement(Draggable, Object.assign({ useDragButton: variant === 'defaultWithHandle', key: item.id, id: item.id }, item.props), item.content));
59
+ }
60
+ }),
61
+ React.createElement(DragOverlay, null, activeId && getDragOverlay())));
62
+ return (React.createElement(DndContext, Object.assign({ sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, onDragStart: handleDragStart }, props),
63
+ children &&
64
+ React.cloneElement(children, {
65
+ children: renderedChildren
66
+ }),
67
+ !children && React.createElement("div", null, renderedChildren)));
68
+ };
69
+ DragDropSort.displayName = 'DragDropSort';
70
+ //# sourceMappingURL=DragDropSort.js.map
@@ -0,0 +1 @@
1
+ {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,EAAE,IAAI,CAAC,EAAE,IAAM,IAAI,CAAC,KAAK,GAC7D,IAAI,CAAC,OAAO,CACS,CACzB,CAAC;gBACJ;oBACE,OAAO,CACL,oBAAC,SAAS,kBAAC,aAAa,EAAE,OAAO,KAAK,mBAAmB,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,IAAM,IAAI,CAAC,KAAK,GACjG,IAAI,CAAC,OAAO,CACH,CACb,CAAC;aACL;QACH,CAAC,CAAC;QACF,oBAAC,WAAW,QAAE,QAAQ,IAAI,cAAc,EAAE,CAAe,CACzC,CACnB,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,kBACT,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,aAAa,EACjC,SAAS,EAAE,aAAa,EACxB,WAAW,EAAE,eAAe,IACxB,KAAK;QAER,QAAQ;YACP,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;gBAC3B,QAAQ,EAAE,gBAAgB;aAC3B,CAAC;QACH,CAAC,QAAQ,IAAI,iCAAM,gBAAgB,CAAO,CAChC,CACd,CAAC;AACJ,CAAC,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export interface DraggableObject {
3
+ /** Unique id of the draggable object */
4
+ id: string;
5
+ /** Content rendered in the draggable object */
6
+ content: React.ReactNode;
7
+ /** Props spread to the rendered wrapper of the draggable object */
8
+ props?: any;
9
+ }
10
+ //# sourceMappingURL=DragDropUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragDropUtil.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropUtil.tsx"],"names":[],"mappings":";AAAA,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,mEAAmE;IACnE,KAAK,CAAC,EAAE,GAAG,CAAC;CACb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DragDropUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragDropUtil.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropUtil.tsx"],"names":[],"mappings":""}
@@ -2,13 +2,11 @@ import * as React from 'react';
2
2
  export interface DraggableProps extends React.HTMLProps<HTMLDivElement> {
3
3
  /** Content rendered inside DragDrop */
4
4
  children?: React.ReactNode;
5
- /** Don't wrap the component in a div. Requires passing a single child. */
6
- hasNoWrapper?: boolean;
7
5
  /** Class to add to outer div */
8
6
  className?: string;
9
- /** */
7
+ /** @hide Id of the sortable context. */
10
8
  id?: string;
11
- /** */
9
+ /** Flag indicating the draggable element should include a drag button. */
12
10
  useDragButton?: boolean;
13
11
  }
14
12
  export declare const Draggable: React.FunctionComponent<DraggableProps>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Draggable.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Draggable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IACrE,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAsC7D,CAAC"}
@@ -3,20 +3,20 @@ import * as React from 'react';
3
3
  import { useSortable } from '@dnd-kit/sortable';
4
4
  import { CSS } from '@dnd-kit/utilities';
5
5
  import { css } from '@patternfly/react-styles';
6
- import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop';
6
+ import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop.mjs';
7
7
  import { DragButton } from './DragButton';
8
8
  export const Draggable = (_a) => {
9
9
  var { children, id, className, useDragButton = false } = _a, props = __rest(_a, ["children", "id", "className", "useDragButton"]);
10
- const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
10
+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
11
11
  id
12
12
  });
13
13
  const style = {
14
14
  transform: CSS.Transform.toString(transform),
15
15
  transition
16
16
  };
17
- return useDragButton ? (React.createElement("div", Object.assign({ className: css(styles.draggable, className), ref: setNodeRef, style: style }, props),
17
+ return useDragButton ? (React.createElement("div", Object.assign({ className: css(isDragging && styles.droppable, isDragging && styles.modifiers.dragging, className), ref: setNodeRef, style: style }, props),
18
18
  React.createElement(DragButton, Object.assign({}, attributes, listeners)),
19
- children)) : (React.createElement("div", Object.assign({ className: css(styles.draggable, className), ref: setNodeRef, style: style }, listeners, attributes, props), children));
19
+ children)) : (React.createElement("div", Object.assign({ className: css(isDragging && styles.droppable, isDragging && styles.modifiers.dragging, className), ref: setNodeRef, style: style }, listeners, attributes, props), children));
20
20
  };
21
21
  Draggable.displayName = 'Draggable';
22
22
  //# sourceMappingURL=Draggable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Draggable.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Draggable.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,MAAM,uEAAmE;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa1C,MAAM,CAAC,MAAM,SAAS,GAA4C,CAAC,EAMlD,EAAE,EAAE;QAN8C,EACjE,QAAQ,EACR,EAAE,EACF,SAAS,EACT,aAAa,GAAG,KAAK,OAEN,EADZ,KAAK,cALyD,gDAMlE,CADS;IAER,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QAC3F,EAAE;KACH,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,UAAU;KACX,CAAC;IAEF,OAAO,aAAa,CAAC,CAAC,CAAC,CACrB,2CACE,SAAS,EAAE,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClG,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,IACR,KAAK;QAET,oBAAC,UAAU,oBAAK,UAAU,EAAM,SAAS,EAAI;QAC5C,QAAQ,CACL,CACP,CAAC,CAAC,CAAC,CACF,2CACE,SAAS,EAAE,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClG,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,IACR,SAAS,EACT,UAAU,EACV,KAAK,GAER,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
@@ -6,11 +6,9 @@ export interface DraggableDataListItemObject {
6
6
  export interface DraggableDataListItemProps extends React.HTMLProps<HTMLLIElement> {
7
7
  /** Content rendered inside DragDrop */
8
8
  children?: React.ReactNode;
9
- /** Don't wrap the component in a div. Requires passing a single child. */
10
- hasNoWrapper?: boolean;
11
9
  /** Class to add to outer div */
12
10
  className?: string;
13
- /** */
11
+ /** @hide Id of the sortable context. */
14
12
  id?: string;
15
13
  }
16
14
  export declare const DraggableDataListItem: React.FunctionComponent<DraggableDataListItemProps>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableDataListItem.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDataListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,2BAA2B;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAChF,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAoCrF,CAAC"}
@@ -3,19 +3,20 @@ import * as React from 'react';
3
3
  import { useSortable } from '@dnd-kit/sortable';
4
4
  import { CSS } from '@dnd-kit/utilities';
5
5
  import { css } from '@patternfly/react-styles';
6
- import styles from '@patternfly/react-styles/css/components/DataList/data-list';
6
+ import styles from '@patternfly/react-styles/css/components/DataList/data-list.mjs';
7
+ import dragStyles from '@patternfly/react-styles/css/components/DragDrop/drag-drop.mjs';
7
8
  import { DragButton } from './DragButton';
8
9
  import { DataListItemRow, DataListControl } from '@patternfly/react-core';
9
10
  export const DraggableDataListItem = (_a) => {
10
11
  var { children, id, className } = _a, props = __rest(_a, ["children", "id", "className"]);
11
- const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
12
+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
12
13
  id
13
14
  });
14
15
  const style = {
15
16
  transform: CSS.Transform.toString(transform),
16
17
  transition
17
18
  };
18
- return (React.createElement("li", Object.assign({ id: id, className: css(styles.dataListItem, className) }, props, { ref: setNodeRef, style: style }),
19
+ return (React.createElement("li", Object.assign({ id: id, className: css(styles.dataListItem, isDragging && dragStyles.droppable, isDragging && dragStyles.modifiers.dragging, className) }, props, { ref: setNodeRef, style: style }),
19
20
  React.createElement(DataListItemRow, null,
20
21
  React.createElement(DataListControl, null,
21
22
  React.createElement(DragButton, Object.assign({ className: css(styles.dataListItemDraggableButton) }, attributes, listeners))),
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableDataListItem.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDataListItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,MAAM,uEAAmE;AAChF,OAAO,UAAU,uEAAmE;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAgB1E,MAAM,CAAC,MAAM,qBAAqB,GAAwD,CAAC,EAK9D,EAAE,EAAE;QAL0D,EACzF,QAAQ,EACR,EAAE,EACF,SAAS,OAEkB,EADxB,KAAK,cAJiF,+BAK1F,CADS;IAER,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QAC3F,EAAE;KACH,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,UAAU;KACX,CAAC;IAEF,OAAO,CACL,0CACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,GAAG,CACZ,MAAM,CAAC,YAAY,EACnB,UAAU,IAAI,UAAU,CAAC,SAAS,EAClC,UAAU,IAAI,UAAU,CAAC,SAAS,CAAC,QAAQ,EAC3C,SAAS,CACV,IACG,KAAK,IACT,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK;QAEZ,oBAAC,eAAe;YACd,oBAAC,eAAe;gBACd,oBAAC,UAAU,kBAAC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,2BAA2B,CAAC,IAAM,UAAU,EAAM,SAAS,EAAI,CACjF;YACjB,QAAQ,CACO,CACf,CACN,CAAC;AACJ,CAAC,CAAC;AACF,qBAAqB,CAAC,WAAW,GAAG,uBAAuB,CAAC"}
@@ -1,8 +1,4 @@
1
1
  import * as React from 'react';
2
- export interface DraggableObject {
3
- id?: string;
4
- content?: React.ReactNode;
5
- }
6
2
  export interface DraggableDualListSelectorListItemProps extends React.HTMLProps<HTMLLIElement> {
7
3
  /** Content rendered inside DragDrop */
8
4
  children?: React.ReactNode;
@@ -10,7 +6,7 @@ export interface DraggableDualListSelectorListItemProps extends React.HTMLProps<
10
6
  hasNoWrapper?: boolean;
11
7
  /** Class to add to outer div */
12
8
  className?: string;
13
- /** */
9
+ /** @hide Id of the sortable context */
14
10
  id?: string;
15
11
  /** Flag indicating the list item is currently selected. */
16
12
  isSelected?: boolean;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableDualListSelectorListItem.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDualListSelectorListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,sCAAuC,SAAQ,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAC5F,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kDAAkD;IAClD,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtG,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAC1C,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,iCAAiC,EAAE,KAAK,CAAC,iBAAiB,CAAC,sCAAsC,CA6D7G,CAAC"}
@@ -3,20 +3,22 @@ import * as React from 'react';
3
3
  import { useSortable } from '@dnd-kit/sortable';
4
4
  import { CSS } from '@dnd-kit/utilities';
5
5
  import { css } from '@patternfly/react-styles';
6
- import styles from '@patternfly/react-styles/css/components/DualListSelector/dual-list-selector';
6
+ import styles from '@patternfly/react-styles/css/components/DualListSelector/dual-list-selector.mjs';
7
+ import dragStyles from '@patternfly/react-styles/css/components/DragDrop/drag-drop.mjs';
7
8
  import { DragButton } from './DragButton';
8
- import { DualListSelectorListContext } from '@patternfly/react-core';
9
+ import { DualListSelectorListContext } from '@patternfly/react-core/dist/esm/components/DualListSelector';
9
10
  export const DraggableDualListSelectorListItem = (_a) => {
10
11
  var { children, id, className, orderIndex, isSelected, onOptionSelect } = _a, props = __rest(_a, ["children", "id", "className", "orderIndex", "isSelected", "onOptionSelect"]);
11
- const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
12
- id
12
+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
13
+ id,
14
+ animateLayoutChanges: () => false
13
15
  });
14
16
  const { setFocusedOption } = React.useContext(DualListSelectorListContext);
15
17
  const style = {
16
18
  transform: CSS.Transform.toString(transform),
17
19
  transition
18
20
  };
19
- return (React.createElement("li", Object.assign({ className: css(styles.dualListSelectorListItem, className), key: orderIndex, id: id, ref: setNodeRef, style: style }, props),
21
+ return (React.createElement("li", Object.assign({ className: css(styles.dualListSelectorListItem, isDragging && dragStyles.droppable, isDragging && dragStyles.modifiers.dragging, className), key: orderIndex, id: id, role: "presentation" }, props, { ref: setNodeRef, style: style }),
20
22
  React.createElement("div", { className: css(styles.dualListSelectorListItemRow, isSelected && styles.modifiers.selected) },
21
23
  React.createElement(DragButton, Object.assign({ className: css(styles.dualListSelectorDraggable) }, attributes, listeners)),
22
24
  React.createElement("span", { className: css(styles.dualListSelectorItem), onKeyDown: (e) => {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableDualListSelectorListItem.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDualListSelectorListItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,MAAM,wFAAoF;AACjG,OAAO,UAAU,uEAAmE;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAC;AAuB1G,MAAM,CAAC,MAAM,iCAAiC,GAAoE,CAAC,EAQ1E,EAAE,EAAE;QARsE,EACjH,QAAQ,EACR,EAAE,EACF,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,OAEyB,EADpC,KAAK,cAPyG,6EAQlH,CADS;IAER,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE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AE,CAAC,CAAC;oBACrB,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACxB,CAAC,EACD,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC;gBAEZ,8BAAM,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,wBAAwB,CAAC;oBACnD,8BAAM,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAG,QAAQ,CAAQ,CACnE,CACF,CACH,CACH,CACN,CAAC;AACJ,CAAC,CAAC;AACF,iCAAiC,CAAC,WAAW,GAAG,mCAAmC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Droppable.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Droppable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAC9D,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sHAAsH;IACtH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAS7D,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Droppable.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Droppable.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAe7C,MAAM,CAAC,MAAM,SAAS,GAA4C,CAAC,EAAsC,EAAE,EAAE;QAA1C,EAAE,QAAQ,OAA4B,EAAvB,KAAK,cAApB,YAAsB,CAAF;IACrF,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAEtD,OAAO,CACL,2CAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,IAAM,KAAK,GAC1C,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DroppableContext.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DroppableContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DroppableContext.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DroppableContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC;IAClD,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,oBAAoB;CAClC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './DragDropSort';
2
+ export * from './DragDropUtil';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './DragDropSort';
2
+ export * from './DragDropUtil';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/next/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/next/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}