@patternfly/react-drag-drop 5.0.0-alpha.0

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 (102) hide show
  1. package/dist/cjs.tsbuildinfo +1 -0
  2. package/dist/esm/components/DragDrop/DragButton.d.ts +11 -0
  3. package/dist/esm/components/DragDrop/DragButton.d.ts.map +1 -0
  4. package/dist/esm/components/DragDrop/DragButton.js +13 -0
  5. package/dist/esm/components/DragDrop/DragButton.js.map +1 -0
  6. package/dist/esm/components/DragDrop/DragDropSort.d.ts +27 -0
  7. package/dist/esm/components/DragDrop/DragDropSort.d.ts.map +1 -0
  8. package/dist/esm/components/DragDrop/DragDropSort.js +45 -0
  9. package/dist/esm/components/DragDrop/DragDropSort.js.map +1 -0
  10. package/dist/esm/components/DragDrop/Draggable.d.ts +15 -0
  11. package/dist/esm/components/DragDrop/Draggable.d.ts.map +1 -0
  12. package/dist/esm/components/DragDrop/Draggable.js +22 -0
  13. package/dist/esm/components/DragDrop/Draggable.js.map +1 -0
  14. package/dist/esm/components/DragDrop/DraggableDataListItem.d.ts +17 -0
  15. package/dist/esm/components/DragDrop/DraggableDataListItem.d.ts.map +1 -0
  16. package/dist/esm/components/DragDrop/DraggableDataListItem.js +25 -0
  17. package/dist/esm/components/DragDrop/DraggableDataListItem.js.map +1 -0
  18. package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.d.ts +27 -0
  19. package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +1 -0
  20. package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.js +35 -0
  21. package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -0
  22. package/dist/esm/components/DragDrop/Droppable.d.ts +16 -0
  23. package/dist/esm/components/DragDrop/Droppable.d.ts.map +1 -0
  24. package/dist/esm/components/DragDrop/Droppable.js +11 -0
  25. package/dist/esm/components/DragDrop/Droppable.js.map +1 -0
  26. package/dist/esm/components/DragDrop/DroppableContext.d.ts +6 -0
  27. package/dist/esm/components/DragDrop/DroppableContext.d.ts.map +1 -0
  28. package/dist/esm/components/DragDrop/DroppableContext.js +6 -0
  29. package/dist/esm/components/DragDrop/DroppableContext.js.map +1 -0
  30. package/dist/esm/components/DragDrop/index.d.ts +2 -0
  31. package/dist/esm/components/DragDrop/index.d.ts.map +1 -0
  32. package/dist/esm/components/DragDrop/index.js +2 -0
  33. package/dist/esm/components/DragDrop/index.js.map +1 -0
  34. package/dist/esm/components/index.d.ts +2 -0
  35. package/dist/esm/components/index.d.ts.map +1 -0
  36. package/dist/esm/components/index.js +2 -0
  37. package/dist/esm/components/index.js.map +1 -0
  38. package/dist/esm/index.d.ts +2 -0
  39. package/dist/esm/index.d.ts.map +1 -0
  40. package/dist/esm/index.js +2 -0
  41. package/dist/esm/index.js.map +1 -0
  42. package/dist/esm.tsbuildinfo +1 -0
  43. package/dist/js/components/DragDrop/DragButton.d.ts +11 -0
  44. package/dist/js/components/DragDrop/DragButton.d.ts.map +1 -0
  45. package/dist/js/components/DragDrop/DragButton.js +17 -0
  46. package/dist/js/components/DragDrop/DragButton.js.map +1 -0
  47. package/dist/js/components/DragDrop/DragDropSort.d.ts +27 -0
  48. package/dist/js/components/DragDrop/DragDropSort.d.ts.map +1 -0
  49. package/dist/js/components/DragDrop/DragDropSort.js +50 -0
  50. package/dist/js/components/DragDrop/DragDropSort.js.map +1 -0
  51. package/dist/js/components/DragDrop/Draggable.d.ts +15 -0
  52. package/dist/js/components/DragDrop/Draggable.d.ts.map +1 -0
  53. package/dist/js/components/DragDrop/Draggable.js +26 -0
  54. package/dist/js/components/DragDrop/Draggable.js.map +1 -0
  55. package/dist/js/components/DragDrop/DraggableDataListItem.d.ts +17 -0
  56. package/dist/js/components/DragDrop/DraggableDataListItem.d.ts.map +1 -0
  57. package/dist/js/components/DragDrop/DraggableDataListItem.js +29 -0
  58. package/dist/js/components/DragDrop/DraggableDataListItem.js.map +1 -0
  59. package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.d.ts +27 -0
  60. package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +1 -0
  61. package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.js +39 -0
  62. package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -0
  63. package/dist/js/components/DragDrop/Droppable.d.ts +16 -0
  64. package/dist/js/components/DragDrop/Droppable.d.ts.map +1 -0
  65. package/dist/js/components/DragDrop/Droppable.js +15 -0
  66. package/dist/js/components/DragDrop/Droppable.js.map +1 -0
  67. package/dist/js/components/DragDrop/DroppableContext.d.ts +6 -0
  68. package/dist/js/components/DragDrop/DroppableContext.d.ts.map +1 -0
  69. package/dist/js/components/DragDrop/DroppableContext.js +10 -0
  70. package/dist/js/components/DragDrop/DroppableContext.js.map +1 -0
  71. package/dist/js/components/DragDrop/index.d.ts +2 -0
  72. package/dist/js/components/DragDrop/index.d.ts.map +1 -0
  73. package/dist/js/components/DragDrop/index.js +5 -0
  74. package/dist/js/components/DragDrop/index.js.map +1 -0
  75. package/dist/js/components/index.d.ts +2 -0
  76. package/dist/js/components/index.d.ts.map +1 -0
  77. package/dist/js/components/index.js +5 -0
  78. package/dist/js/components/index.js.map +1 -0
  79. package/dist/js/index.d.ts +2 -0
  80. package/dist/js/index.d.ts.map +1 -0
  81. package/dist/js/index.js +5 -0
  82. package/dist/js/index.js.map +1 -0
  83. package/package.json +50 -0
  84. package/src/components/DragDrop/DragButton.tsx +22 -0
  85. package/src/components/DragDrop/DragDropSort.tsx +123 -0
  86. package/src/components/DragDrop/Draggable.tsx +55 -0
  87. package/src/components/DragDrop/DraggableDataListItem.tsx +51 -0
  88. package/src/components/DragDrop/DraggableDualListSelectorListItem.tsx +90 -0
  89. package/src/components/DragDrop/Droppable.tsx +27 -0
  90. package/src/components/DragDrop/DroppableContext.ts +6 -0
  91. package/src/components/DragDrop/__tests__/DragDrop.test.tsx +19 -0
  92. package/src/components/DragDrop/__tests__/__snapshots__/DragDrop.test.tsx.snap +57 -0
  93. package/src/components/DragDrop/examples/BasicSorting.tsx +24 -0
  94. package/src/components/DragDrop/examples/BasicSortingWithDragButton.tsx +25 -0
  95. package/src/components/DragDrop/examples/DataListDraggable.tsx +46 -0
  96. package/src/components/DragDrop/examples/DragDrop.md +57 -0
  97. package/src/components/DragDrop/examples/DualListSelectorDraggable.tsx +174 -0
  98. package/src/components/DragDrop/index.ts +1 -0
  99. package/src/components/index.ts +1 -0
  100. package/src/index.ts +1 -0
  101. package/tsconfig.cjs.json +8 -0
  102. package/tsconfig.json +23 -0
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import { DndContext, closestCenter, DragOverlay, KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
3
+ import { arrayMove, SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from '@dnd-kit/sortable';
4
+ import { Draggable } from './Draggable';
5
+ import { DragButton } from './DragButton';
6
+ import { DraggableDataListItem } from './DraggableDataListItem';
7
+ import { DraggableDualListSelectorListItem } from './DraggableDualListSelectorListItem';
8
+ export const DragDropSort = ({ items, onDrop = () => { }, onDrag = () => { }, variant = 'default' }) => {
9
+ const [activeId, setActiveId] = React.useState(null);
10
+ const itemIds = React.useMemo(() => (items ? Array.from(items, item => item.id) : []), [items]);
11
+ const getItemById = (id) => items.find(item => item.id === id);
12
+ const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
13
+ coordinateGetter: sortableKeyboardCoordinates
14
+ }));
15
+ const handleDragEnd = (event) => {
16
+ const { active, over } = event;
17
+ const oldIndex = itemIds.indexOf(active.id);
18
+ const newIndex = itemIds.indexOf(over.id);
19
+ const newItems = arrayMove(items, oldIndex, newIndex);
20
+ onDrop(newItems, oldIndex, newIndex);
21
+ return newItems;
22
+ };
23
+ const handleDragStart = (event) => {
24
+ setActiveId(event.active.id);
25
+ onDrag(itemIds.indexOf(event.active.id));
26
+ };
27
+ return (React.createElement(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, onDragStart: handleDragStart },
28
+ React.createElement(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy },
29
+ items.map((item) => {
30
+ switch (variant) {
31
+ case 'DualListSelectorList':
32
+ return (React.createElement(DraggableDualListSelectorListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
33
+ case 'DataList':
34
+ return (React.createElement(DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
35
+ default:
36
+ return (React.createElement(Draggable, Object.assign({ useDragButton: variant === 'defaultWithHandle', key: item.id, id: item.id }, item.props), item.content));
37
+ }
38
+ }),
39
+ React.createElement(DragOverlay, null,
40
+ React.createElement("div", { className: "pf-c-draggable pf-m-dragging pf-l-flex" },
41
+ React.createElement("span", { className: "pf-l-flex__item" }, variant !== 'default' && React.createElement(DragButton, null)),
42
+ React.createElement("span", { className: "pf-l-flex__item" }, activeId ? getItemById(activeId).content : null))))));
43
+ };
44
+ DragDropSort.displayName = 'DragDropSort';
45
+ //# sourceMappingURL=DragDropSort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragDropSort.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropSort.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,UAAU,EACV,aAAa,EACb,WAAW,EAEX,cAAc,EACd,aAAa,EACb,SAAS,EACT,UAAU,EAGX,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,eAAe,EACf,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AA2BxF,MAAM,CAAC,M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AAO,KAAK,SAAS,IAAI,oBAAC,UAAU,OAAG,CAAQ;oBAClF,8BAAM,SAAS,EAAC,iBAAiB,IAAE,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAQ,CACtF,CACM,CACE,CACP,CACd,CAAC;AACJ,CAAC,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ export interface DraggableProps extends React.HTMLProps<HTMLDivElement> {
3
+ /** Content rendered inside DragDrop */
4
+ children?: React.ReactNode;
5
+ /** Don't wrap the component in a div. Requires passing a single child. */
6
+ hasNoWrapper?: boolean;
7
+ /** Class to add to outer div */
8
+ className?: string;
9
+ /** */
10
+ id?: string;
11
+ /** */
12
+ useDragButton?: boolean;
13
+ }
14
+ export declare const Draggable: React.FunctionComponent<DraggableProps>;
15
+ //# sourceMappingURL=Draggable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Draggable.d.ts","sourceRoot":"","sources":["../../../../src/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,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM;IACN,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAiC7D,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import { useSortable } from '@dnd-kit/sortable';
4
+ import { CSS } from '@dnd-kit/utilities';
5
+ import { css } from '@patternfly/react-styles';
6
+ import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop';
7
+ import { DragButton } from './DragButton';
8
+ export const Draggable = (_a) => {
9
+ var { children, id, className, useDragButton = false } = _a, props = __rest(_a, ["children", "id", "className", "useDragButton"]);
10
+ const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
11
+ id
12
+ });
13
+ const style = {
14
+ transform: CSS.Transform.toString(transform),
15
+ transition
16
+ };
17
+ return useDragButton ? (React.createElement("div", Object.assign({ className: css(styles.draggable, className), ref: setNodeRef, style: style }, props),
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));
20
+ };
21
+ Draggable.displayName = 'Draggable';
22
+ //# sourceMappingURL=Draggable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Draggable.js","sourceRoot":"","sources":["../../../../src/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,MAAM,4DAA4D,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C,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,GAAG,WAAW,CAAC;QAC/E,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,2CAAK,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,IAAM,KAAK;QACxF,oBAAC,UAAU,oBAAK,UAAU,EAAM,SAAS,EAAI;QAC5C,QAAQ,CACL,CACP,CAAC,CAAC,CAAC,CACF,2CACE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,EAC3C,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"}
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ export interface DraggableDataListItemObject {
3
+ id?: string;
4
+ content?: React.ReactNode;
5
+ }
6
+ export interface DraggableDataListItemProps extends React.HTMLProps<HTMLLIElement> {
7
+ /** Content rendered inside DragDrop */
8
+ children?: React.ReactNode;
9
+ /** Don't wrap the component in a div. Requires passing a single child. */
10
+ hasNoWrapper?: boolean;
11
+ /** Class to add to outer div */
12
+ className?: string;
13
+ /** */
14
+ id?: string;
15
+ }
16
+ export declare const DraggableDataListItem: React.FunctionComponent<DraggableDataListItemProps>;
17
+ //# sourceMappingURL=DraggableDataListItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableDataListItem.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DraggableDataListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/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,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM;IACN,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAyBrF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import { useSortable } from '@dnd-kit/sortable';
4
+ import { CSS } from '@dnd-kit/utilities';
5
+ import { css } from '@patternfly/react-styles';
6
+ import styles from '@patternfly/react-styles/css/components/DataList/data-list';
7
+ import { DragButton } from './DragButton';
8
+ import { DataListItemRow, DataListControl } from '@patternfly/react-core';
9
+ export const DraggableDataListItem = (_a) => {
10
+ var { children, id, className } = _a, props = __rest(_a, ["children", "id", "className"]);
11
+ const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
12
+ id
13
+ });
14
+ const style = {
15
+ transform: CSS.Transform.toString(transform),
16
+ transition
17
+ };
18
+ return (React.createElement("li", Object.assign({ id: id, className: css(styles.dataListItem, className) }, props, { ref: setNodeRef, style: style }),
19
+ React.createElement(DataListItemRow, null,
20
+ React.createElement(DataListControl, null,
21
+ React.createElement(DragButton, Object.assign({ className: css(styles.dataListItemDraggableButton) }, attributes, listeners))),
22
+ children)));
23
+ };
24
+ DraggableDataListItem.displayName = 'DraggableDataListItem';
25
+ //# sourceMappingURL=DraggableDataListItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableDataListItem.js","sourceRoot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
+ import * as React from 'react';
2
+ export interface DraggableObject {
3
+ id?: string;
4
+ content?: React.ReactNode;
5
+ }
6
+ export interface DraggableDualListSelectorListItemProps extends React.HTMLProps<HTMLLIElement> {
7
+ /** Content rendered inside DragDrop */
8
+ children?: React.ReactNode;
9
+ /** Don't wrap the component in a div. Requires passing a single child. */
10
+ hasNoWrapper?: boolean;
11
+ /** Class to add to outer div */
12
+ className?: string;
13
+ /** */
14
+ id?: string;
15
+ /** Flag indicating the list item is currently selected. */
16
+ isSelected?: boolean;
17
+ /** Callback fired when an option is selected. */
18
+ onOptionSelect?: (e: React.MouseEvent | React.ChangeEvent | React.KeyboardEvent, id?: string) => void;
19
+ /** @hide Internal field used to keep track of order of unfiltered options. */
20
+ orderIndex?: number;
21
+ /** @hide Forwarded ref */
22
+ innerRef?: React.RefObject<HTMLLIElement>;
23
+ /** Flag indicating if the dual list selector is in a disabled state */
24
+ isDisabled?: boolean;
25
+ }
26
+ export declare const DraggableDualListSelectorListItem: React.FunctionComponent<DraggableDualListSelectorListItemProps>;
27
+ //# sourceMappingURL=DraggableDualListSelectorListItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableDualListSelectorListItem.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DraggableDualListSelectorListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,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,MAAM;IACN,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,CAsD7G,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import { useSortable } from '@dnd-kit/sortable';
4
+ import { CSS } from '@dnd-kit/utilities';
5
+ import { css } from '@patternfly/react-styles';
6
+ import styles from '@patternfly/react-styles/css/components/DualListSelector/dual-list-selector';
7
+ import { DragButton } from './DragButton';
8
+ import { DualListSelectorListContext } from '@patternfly/react-core';
9
+ export const DraggableDualListSelectorListItem = (_a) => {
10
+ 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
13
+ });
14
+ const { setFocusedOption } = React.useContext(DualListSelectorListContext);
15
+ const style = {
16
+ transform: CSS.Transform.toString(transform),
17
+ transition
18
+ };
19
+ return (React.createElement("li", Object.assign({ className: css(styles.dualListSelectorListItem, className), key: orderIndex, id: id, ref: setNodeRef, style: style }, props),
20
+ React.createElement("div", { className: css(styles.dualListSelectorListItemRow, isSelected && styles.modifiers.selected) },
21
+ React.createElement(DragButton, Object.assign({ className: css(styles.dualListSelectorDraggable) }, attributes, listeners)),
22
+ React.createElement("span", { className: css(styles.dualListSelectorItem), onKeyDown: (e) => {
23
+ if (e.key === ' ' || e.key === 'Enter') {
24
+ document.activeElement.click();
25
+ e.preventDefault();
26
+ }
27
+ }, "aria-selected": isSelected, onClick: (e) => {
28
+ setFocusedOption(id);
29
+ onOptionSelect(e, id);
30
+ }, role: "option", tabIndex: -1 },
31
+ React.createElement("span", { className: css(styles.dualListSelectorItemMain) },
32
+ React.createElement("span", { className: css(styles.dualListSelectorItemText) }, children))))));
33
+ };
34
+ DraggableDualListSelectorListItem.displayName = 'DraggableDualListSelectorListItem';
35
+ //# sourceMappingURL=DraggableDualListSelectorListItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableDualListSelectorListItem.js","sourceRoot":"","sources":["../../../../src/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,MAAM,6EAA6E,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AA4BrE,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,SAAS,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QAC/E,EAAE;KACH,CAAC,CAAC;IAEH,MAAM,EAAE,gB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AC,IAAG,QAAQ,CAAQ,CACnE,CACF,CACH,CACH,CACN,CAAC;AACJ,CAAC,CAAC;AACF,iCAAiC,CAAC,WAAW,GAAG,mCAAmC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ interface DroppableProps extends React.HTMLProps<HTMLDivElement> {
3
+ /** Content rendered inside DragDrop */
4
+ children?: React.ReactNode;
5
+ /** Class to add to outer div */
6
+ className?: string;
7
+ /** Name of zone that items can be dragged between. Should specify if there is more than one Droppable on the page. */
8
+ zone?: string;
9
+ /** Id to be passed back on drop events */
10
+ droppableId?: string;
11
+ /** Don't wrap the component in a div. Requires passing a single child. */
12
+ hasNoWrapper?: boolean;
13
+ }
14
+ export declare const Droppable: React.FunctionComponent<DroppableProps>;
15
+ export {};
16
+ //# sourceMappingURL=Droppable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Droppable.d.ts","sourceRoot":"","sources":["../../../../src/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,11 @@
1
+ import { __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import { useDroppable } from '@dnd-kit/core';
4
+ export const Droppable = (_a) => {
5
+ var { children } = _a, props = __rest(_a, ["children"]);
6
+ const { isOver, setNodeRef } = useDroppable({ id: 'droppable' });
7
+ const style = { color: isOver ? 'green' : undefined };
8
+ return (React.createElement("div", Object.assign({ ref: setNodeRef, style: style }, props), children));
9
+ };
10
+ Droppable.displayName = 'Droppable';
11
+ //# sourceMappingURL=Droppable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Droppable.js","sourceRoot":"","sources":["../../../../src/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,6 @@
1
+ import * as React from 'react';
2
+ export declare const DroppableContext: React.Context<{
3
+ zone: string;
4
+ droppableId: string;
5
+ }>;
6
+ //# sourceMappingURL=DroppableContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DroppableContext.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DroppableContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export const DroppableContext = React.createContext({
3
+ zone: 'defaultDroppableZone',
4
+ droppableId: 'defaultDroppableId'
5
+ });
6
+ //# sourceMappingURL=DroppableContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DroppableContext.js","sourceRoot":"","sources":["../../../../src/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,2 @@
1
+ export * from './DragDropSort';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './DragDropSort';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './DragDrop';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './DragDrop';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/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/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/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}