@patternfly/react-drag-drop 6.0.0-alpha.71 → 6.0.0-alpha.73

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 (160) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs.tsbuildinfo +1 -1
  3. package/dist/esm/components/DragDrop/DragDropContainer.d.ts +41 -0
  4. package/dist/esm/components/DragDrop/DragDropContainer.d.ts.map +1 -0
  5. package/dist/esm/components/DragDrop/DragDropContainer.js +147 -0
  6. package/dist/esm/components/DragDrop/DragDropContainer.js.map +1 -0
  7. package/dist/esm/components/DragDrop/DragDropSort.d.ts +5 -11
  8. package/dist/esm/components/DragDrop/DragDropSort.d.ts.map +1 -1
  9. package/dist/esm/components/DragDrop/DragDropSort.js +11 -59
  10. package/dist/esm/components/DragDrop/DragDropSort.js.map +1 -1
  11. package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.js +2 -2
  12. package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -1
  13. package/dist/esm/components/DragDrop/Droppable.d.ts +15 -9
  14. package/dist/esm/components/DragDrop/Droppable.d.ts.map +1 -1
  15. package/dist/esm/components/DragDrop/Droppable.js +21 -4
  16. package/dist/esm/components/DragDrop/Droppable.js.map +1 -1
  17. package/dist/esm/components/DragDrop/index.d.ts +2 -0
  18. package/dist/esm/components/DragDrop/index.d.ts.map +1 -1
  19. package/dist/esm/components/DragDrop/index.js +2 -0
  20. package/dist/esm/components/DragDrop/index.js.map +1 -1
  21. package/dist/esm.tsbuildinfo +1 -1
  22. package/dist/js/components/DragDrop/DragDropContainer.d.ts +41 -0
  23. package/dist/js/components/DragDrop/DragDropContainer.d.ts.map +1 -0
  24. package/dist/js/components/DragDrop/DragDropContainer.js +151 -0
  25. package/dist/js/components/DragDrop/DragDropContainer.js.map +1 -0
  26. package/dist/js/components/DragDrop/DragDropSort.d.ts +5 -11
  27. package/dist/js/components/DragDrop/DragDropSort.d.ts.map +1 -1
  28. package/dist/js/components/DragDrop/DragDropSort.js +11 -59
  29. package/dist/js/components/DragDrop/DragDropSort.js.map +1 -1
  30. package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.js +2 -2
  31. package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -1
  32. package/dist/js/components/DragDrop/Droppable.d.ts +15 -9
  33. package/dist/js/components/DragDrop/Droppable.d.ts.map +1 -1
  34. package/dist/js/components/DragDrop/Droppable.js +21 -4
  35. package/dist/js/components/DragDrop/Droppable.js.map +1 -1
  36. package/dist/js/components/DragDrop/index.d.ts +2 -0
  37. package/dist/js/components/DragDrop/index.d.ts.map +1 -1
  38. package/dist/js/components/DragDrop/index.js +2 -0
  39. package/dist/js/components/DragDrop/index.js.map +1 -1
  40. package/package.json +5 -5
  41. package/src/components/DragDrop/DragDropContainer.tsx +305 -0
  42. package/src/components/DragDrop/DragDropSort.tsx +22 -137
  43. package/src/components/DragDrop/DraggableDualListSelectorListItem.tsx +2 -2
  44. package/src/components/DragDrop/Droppable.tsx +64 -15
  45. package/src/components/DragDrop/__tests__/DragDrop.test.tsx +5 -0
  46. package/src/components/DragDrop/examples/DataListDraggable.tsx +1 -0
  47. package/src/components/DragDrop/examples/DragDrop.md +8 -2
  48. package/src/components/DragDrop/examples/DragDropContainerBasic.tsx +45 -0
  49. package/src/components/DragDrop/examples/DragDropContainerDataList.tsx +75 -0
  50. package/src/components/DragDrop/examples/DragDropContainerDualListSelector.tsx +191 -0
  51. package/src/components/DragDrop/examples/DragDropDemos.md +25 -1
  52. package/src/components/DragDrop/index.ts +2 -0
  53. package/dist/esm/components/DragDrop/DroppableContext.d.ts +0 -6
  54. package/dist/esm/components/DragDrop/DroppableContext.d.ts.map +0 -1
  55. package/dist/esm/components/DragDrop/DroppableContext.js +0 -6
  56. package/dist/esm/components/DragDrop/DroppableContext.js.map +0 -1
  57. package/dist/esm/next/components/DragDrop/DragButton.d.ts +0 -11
  58. package/dist/esm/next/components/DragDrop/DragButton.d.ts.map +0 -1
  59. package/dist/esm/next/components/DragDrop/DragButton.js +0 -14
  60. package/dist/esm/next/components/DragDrop/DragButton.js.map +0 -1
  61. package/dist/esm/next/components/DragDrop/DragDropSort.d.ts +0 -35
  62. package/dist/esm/next/components/DragDrop/DragDropSort.d.ts.map +0 -1
  63. package/dist/esm/next/components/DragDrop/DragDropSort.js +0 -73
  64. package/dist/esm/next/components/DragDrop/DragDropSort.js.map +0 -1
  65. package/dist/esm/next/components/DragDrop/Draggable.d.ts +0 -13
  66. package/dist/esm/next/components/DragDrop/Draggable.d.ts.map +0 -1
  67. package/dist/esm/next/components/DragDrop/Draggable.js +0 -22
  68. package/dist/esm/next/components/DragDrop/Draggable.js.map +0 -1
  69. package/dist/esm/next/components/DragDrop/DraggableDataListItem.d.ts +0 -15
  70. package/dist/esm/next/components/DragDrop/DraggableDataListItem.d.ts.map +0 -1
  71. package/dist/esm/next/components/DragDrop/DraggableDataListItem.js +0 -26
  72. package/dist/esm/next/components/DragDrop/DraggableDataListItem.js.map +0 -1
  73. package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts +0 -23
  74. package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +0 -1
  75. package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.js +0 -37
  76. package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.js.map +0 -1
  77. package/dist/esm/next/components/DragDrop/Droppable.d.ts +0 -16
  78. package/dist/esm/next/components/DragDrop/Droppable.d.ts.map +0 -1
  79. package/dist/esm/next/components/DragDrop/Droppable.js +0 -11
  80. package/dist/esm/next/components/DragDrop/Droppable.js.map +0 -1
  81. package/dist/esm/next/components/DragDrop/DroppableContext.d.ts +0 -6
  82. package/dist/esm/next/components/DragDrop/DroppableContext.d.ts.map +0 -1
  83. package/dist/esm/next/components/DragDrop/DroppableContext.js +0 -6
  84. package/dist/esm/next/components/DragDrop/DroppableContext.js.map +0 -1
  85. package/dist/esm/next/components/DragDrop/index.d.ts +0 -2
  86. package/dist/esm/next/components/DragDrop/index.d.ts.map +0 -1
  87. package/dist/esm/next/components/DragDrop/index.js +0 -2
  88. package/dist/esm/next/components/DragDrop/index.js.map +0 -1
  89. package/dist/esm/next/components/index.d.ts +0 -2
  90. package/dist/esm/next/components/index.d.ts.map +0 -1
  91. package/dist/esm/next/components/index.js +0 -2
  92. package/dist/esm/next/components/index.js.map +0 -1
  93. package/dist/esm/next/index.d.ts +0 -2
  94. package/dist/esm/next/index.d.ts.map +0 -1
  95. package/dist/esm/next/index.js +0 -2
  96. package/dist/esm/next/index.js.map +0 -1
  97. package/dist/js/components/DragDrop/DroppableContext.d.ts +0 -6
  98. package/dist/js/components/DragDrop/DroppableContext.d.ts.map +0 -1
  99. package/dist/js/components/DragDrop/DroppableContext.js +0 -10
  100. package/dist/js/components/DragDrop/DroppableContext.js.map +0 -1
  101. package/dist/js/next/components/DragDrop/DragButton.d.ts +0 -11
  102. package/dist/js/next/components/DragDrop/DragButton.d.ts.map +0 -1
  103. package/dist/js/next/components/DragDrop/DragButton.js +0 -18
  104. package/dist/js/next/components/DragDrop/DragButton.js.map +0 -1
  105. package/dist/js/next/components/DragDrop/DragDropSort.d.ts +0 -35
  106. package/dist/js/next/components/DragDrop/DragDropSort.d.ts.map +0 -1
  107. package/dist/js/next/components/DragDrop/DragDropSort.js +0 -77
  108. package/dist/js/next/components/DragDrop/DragDropSort.js.map +0 -1
  109. package/dist/js/next/components/DragDrop/Draggable.d.ts +0 -13
  110. package/dist/js/next/components/DragDrop/Draggable.d.ts.map +0 -1
  111. package/dist/js/next/components/DragDrop/Draggable.js +0 -26
  112. package/dist/js/next/components/DragDrop/Draggable.js.map +0 -1
  113. package/dist/js/next/components/DragDrop/DraggableDataListItem.d.ts +0 -15
  114. package/dist/js/next/components/DragDrop/DraggableDataListItem.d.ts.map +0 -1
  115. package/dist/js/next/components/DragDrop/DraggableDataListItem.js +0 -30
  116. package/dist/js/next/components/DragDrop/DraggableDataListItem.js.map +0 -1
  117. package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts +0 -23
  118. package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +0 -1
  119. package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.js +0 -41
  120. package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.js.map +0 -1
  121. package/dist/js/next/components/DragDrop/Droppable.d.ts +0 -16
  122. package/dist/js/next/components/DragDrop/Droppable.d.ts.map +0 -1
  123. package/dist/js/next/components/DragDrop/Droppable.js +0 -15
  124. package/dist/js/next/components/DragDrop/Droppable.js.map +0 -1
  125. package/dist/js/next/components/DragDrop/DroppableContext.d.ts +0 -6
  126. package/dist/js/next/components/DragDrop/DroppableContext.d.ts.map +0 -1
  127. package/dist/js/next/components/DragDrop/DroppableContext.js +0 -10
  128. package/dist/js/next/components/DragDrop/DroppableContext.js.map +0 -1
  129. package/dist/js/next/components/DragDrop/index.d.ts +0 -2
  130. package/dist/js/next/components/DragDrop/index.d.ts.map +0 -1
  131. package/dist/js/next/components/DragDrop/index.js +0 -5
  132. package/dist/js/next/components/DragDrop/index.js.map +0 -1
  133. package/dist/js/next/components/index.d.ts +0 -2
  134. package/dist/js/next/components/index.d.ts.map +0 -1
  135. package/dist/js/next/components/index.js +0 -5
  136. package/dist/js/next/components/index.js.map +0 -1
  137. package/dist/js/next/index.d.ts +0 -2
  138. package/dist/js/next/index.d.ts.map +0 -1
  139. package/dist/js/next/index.js +0 -5
  140. package/dist/js/next/index.js.map +0 -1
  141. package/src/components/DragDrop/DroppableContext.ts +0 -6
  142. package/src/components/DragDrop/examples/BasicSortingWithDragButton.tsx +0 -19
  143. package/src/next/components/DragDrop/DragButton.tsx +0 -27
  144. package/src/next/components/DragDrop/DragDropSort.tsx +0 -186
  145. package/src/next/components/DragDrop/Draggable.tsx +0 -58
  146. package/src/next/components/DragDrop/DraggableDataListItem.tsx +0 -61
  147. package/src/next/components/DragDrop/DraggableDualListSelectorListItem.tsx +0 -93
  148. package/src/next/components/DragDrop/Droppable.tsx +0 -27
  149. package/src/next/components/DragDrop/DroppableContext.ts +0 -6
  150. package/src/next/components/DragDrop/__tests__/DragDrop.test.tsx +0 -24
  151. package/src/next/components/DragDrop/__tests__/__snapshots__/DragDrop.test.tsx.snap +0 -59
  152. package/src/next/components/DragDrop/examples/BasicSortingWithDragButton.tsx +0 -20
  153. package/src/next/components/DragDrop/examples/DataListDraggable.tsx +0 -38
  154. package/src/next/components/DragDrop/examples/DragDrop.md +0 -32
  155. package/src/next/components/DragDrop/examples/DragDropDemos.md +0 -37
  156. package/src/next/components/DragDrop/examples/DualListSelectorDraggable.tsx +0 -150
  157. package/src/next/components/DragDrop/index.ts +0 -1
  158. package/src/next/components/index.ts +0 -1
  159. package/src/next/index.ts +0 -1
  160. /package/src/{next/components → components}/DragDrop/examples/BasicSorting.tsx +0 -0
@@ -1,59 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`renders some divs 1`] = `
4
- <DocumentFragment>
5
- <div
6
- class="pf-c-droppable pf-m-dragging"
7
- >
8
- <div>
9
- <div
10
- aria-describedby="DndDescribedBy-0"
11
- aria-disabled="false"
12
- aria-roledescription="sortable"
13
- class=""
14
- role="button"
15
- tabindex="0"
16
- >
17
- one
18
- </div>
19
- <div
20
- aria-describedby="DndDescribedBy-0"
21
- aria-disabled="false"
22
- aria-roledescription="sortable"
23
- class=""
24
- role="button"
25
- tabindex="0"
26
- >
27
- two
28
- </div>
29
- <div
30
- aria-describedby="DndDescribedBy-0"
31
- aria-disabled="false"
32
- aria-roledescription="sortable"
33
- class=""
34
- role="button"
35
- tabindex="0"
36
- >
37
- three
38
- </div>
39
- </div>
40
- <div
41
- id="DndDescribedBy-0"
42
- style="display: none;"
43
- >
44
-
45
- To pick up a draggable item, press the space bar.
46
- While dragging, use the arrow keys to move the item.
47
- Press space again to drop the item in its new position, or press escape to cancel.
48
-
49
- </div>
50
- <div
51
- aria-atomic="true"
52
- aria-live="assertive"
53
- id="DndLiveRegion-0"
54
- role="status"
55
- style="position: fixed; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;"
56
- />
57
- </div>
58
- </DocumentFragment>
59
- `;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { DragDropSort, DraggableObject } from '@patternfly/react-drag-drop';
3
-
4
- export const BasicSortingWithDragButton: React.FunctionComponent = () => {
5
- const [items, setItems] = React.useState<DraggableObject[]>([
6
- { id: 'with-button-1', content: 'one' },
7
- { id: 'with-button-2', content: 'two' },
8
- { id: 'with-button-3', content: 'three' }
9
- ]);
10
-
11
- return (
12
- <DragDropSort
13
- items={items}
14
- variant="defaultWithHandle"
15
- onDrop={(_, newItems) => {
16
- setItems(newItems);
17
- }}
18
- />
19
- );
20
- };
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { DataList, DataListCell, DataListCheck, DataListControl, DataListItemCells } from '@patternfly/react-core';
3
- import { DragDropSort, DraggableObject } from '@patternfly/react-drag-drop';
4
-
5
- const getItems = (count: number): DraggableObject[] =>
6
- Array.from({ length: count }, (_, idx) => idx).map((idx) => ({
7
- id: `data-list-item-${idx}`,
8
- content: (
9
- <>
10
- <DataListControl>
11
- <DataListCheck aria-labelledby={`item-${idx}`} name={`item-${idx}`} otherControls />
12
- </DataListControl>
13
- <DataListItemCells
14
- dataListCells={[
15
- <DataListCell key={`item-${idx}`}>
16
- <span id={`item-${idx}`}>{`item-${idx}`}</span>
17
- </DataListCell>
18
- ]}
19
- />
20
- </>
21
- )
22
- }));
23
-
24
- export const DataListDraggable: React.FunctionComponent = (props) => {
25
- const [items, setItems] = React.useState<DraggableObject[]>(getItems(10));
26
-
27
- return (
28
- <DragDropSort
29
- items={items}
30
- onDrop={(_, newItems) => {
31
- setItems(newItems);
32
- }}
33
- variant="DataList"
34
- >
35
- <DataList aria-label="draggable data list example" isCompact {...props} />
36
- </DragDropSort>
37
- );
38
- };
@@ -1,32 +0,0 @@
1
- ---
2
- id: Drag and drop
3
- section: components
4
- cssPrefix: pf-c-drag-drop
5
- propComponents: ['DragDropSort', 'DraggableObject']
6
- hideNavItem: true
7
- beta: true
8
- ---
9
-
10
- Note: This drag and drop implementation lives in its own package at [@patternfly/react-drag-drop](https://www.npmjs.com/package/@patternfly/react-drag-drop)!
11
-
12
- import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-left-icon';
13
- import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
14
- import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';
15
- import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
16
- import PficonSortCommonAscIcon from '@patternfly/react-icons/dist/esm/icons/pficon-sort-common-asc-icon';
17
-
18
- import { DragDropSort } from '@patternfly/react-drag-drop';
19
-
20
- ## Sorting examples
21
-
22
- ### Basic drag and drop sorting
23
-
24
- ```ts file="./BasicSorting.tsx"
25
-
26
- ```
27
-
28
- ### Basic drag and drop sorting with drag button
29
-
30
- ```ts file="./BasicSortingWithDragButton.tsx"
31
-
32
- ```
@@ -1,37 +0,0 @@
1
- ---
2
- id: Drag and drop
3
- section: components
4
- source: react-next-demos
5
- propComponents: ['DragDropSort', 'DraggableObject']
6
- beta: true
7
- ---
8
-
9
- Note: This drag and drop implementation lives in its own package at [@patternfly/react-drag-drop](https://www.npmjs.com/package/@patternfly/react-drag-drop)!
10
-
11
- import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-left-icon';
12
- import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
13
- import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';
14
- import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
15
- import PficonSortCommonAscIcon from '@patternfly/react-icons/dist/esm/icons/pficon-sort-common-asc-icon';
16
-
17
- import { DragDropSort } from '@patternfly/react-drag-drop';
18
-
19
- ## Sorting demos
20
-
21
- To enable drag and drop for compatible components, wrap the component with `<DragDropSort>`, define the `variant` property, and pass both the sortable `items` and `onDrop` callback to `<DragDropSort>`. `<DragDropSort>` will create the component's usual `children` internally based on the `items` property, so `children` should not be passed to the wrapped component.
22
-
23
- ### Drag and drop sortable data list
24
-
25
- To enable reordering in a `<DataList>`, wrap the `<DataList>` component with `<DragDropSort>` and define the `variant` as "DataList".
26
-
27
- ```ts file="./DataListDraggable.tsx"
28
-
29
- ```
30
-
31
- ### Drag and drop sortable dual list selector
32
-
33
- To enable reordering in a `<DualListSelector>` pane wrap the `<DualListSelectorList>` component with `<DragDropSort>` and define the `variant` as "DualListSelectorList".
34
-
35
- ```ts file="./DualListSelectorDraggable.tsx"
36
-
37
- ```
@@ -1,150 +0,0 @@
1
- import React from 'react';
2
- import {
3
- DualListSelector,
4
- DualListSelectorPane,
5
- DualListSelectorList,
6
- DualListSelectorListItem,
7
- DualListSelectorControlsWrapper,
8
- DualListSelectorControl
9
- } from '@patternfly/react-core';
10
- import { DragDropSort, DraggableObject } from '@patternfly/react-drag-drop';
11
-
12
- import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-left-icon';
13
- import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
14
- import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';
15
- import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
16
-
17
- export const ComposableDualListSelector: React.FunctionComponent = () => {
18
- const [ignoreNextOptionSelect, setIgnoreNextOptionSelect] = React.useState(false);
19
- const [availableOptions, setAvailableOptions] = React.useState<DraggableObject[]>([
20
- { id: 'Apple', content: 'Apple', props: { key: 'Apple', isSelected: false } },
21
- { id: 'Banana', content: 'Banana', props: { key: 'Banana', isSelected: false } },
22
- { id: 'Pineapple', content: 'Pineapple', props: { key: 'Pineapple', isSelected: false } }
23
- ]);
24
-
25
- const [chosenOptions, setChosenOptions] = React.useState<DraggableObject[]>([
26
- { id: 'Orange', content: 'Orange', props: { key: 'Orange', isSelected: false } },
27
- { id: 'Grape', content: 'Grape', props: { key: 'Grape', isSelected: false } },
28
- { id: 'Peach', content: 'Peach', props: { key: 'Peach', isSelected: false } },
29
- { id: 'Strawberry', content: 'Strawberry', props: { key: 'Strawberry', isSelected: false } }
30
- ]);
31
-
32
- const moveSelected = (fromAvailable) => {
33
- const sourceOptions = fromAvailable ? availableOptions : chosenOptions;
34
- const destinationOptions = fromAvailable ? chosenOptions : availableOptions;
35
- for (let i = 0; i < sourceOptions.length; i++) {
36
- const option = sourceOptions[i];
37
- if (option.props.isSelected) {
38
- sourceOptions.splice(i, 1);
39
- destinationOptions.push(option);
40
- option.props.isSelected = false;
41
- i--;
42
- }
43
- }
44
- if (fromAvailable) {
45
- setAvailableOptions([...sourceOptions]);
46
- setChosenOptions([...destinationOptions]);
47
- } else {
48
- setChosenOptions([...sourceOptions]);
49
- setAvailableOptions([...destinationOptions]);
50
- }
51
- };
52
-
53
- const moveAll = (fromAvailable) => {
54
- if (fromAvailable) {
55
- setChosenOptions([...availableOptions, ...chosenOptions]);
56
- setAvailableOptions([]);
57
- } else {
58
- setAvailableOptions([...chosenOptions, ...availableOptions]);
59
- setChosenOptions([]);
60
- }
61
- };
62
-
63
- const onOptionSelect = (event, index, isChosen) => {
64
- if (ignoreNextOptionSelect) {
65
- setIgnoreNextOptionSelect(false);
66
- return;
67
- }
68
- if (isChosen) {
69
- const newChosen = [...chosenOptions];
70
- newChosen[index].props.isSelected = !chosenOptions[index].props.isSelected;
71
- setChosenOptions(newChosen);
72
- } else {
73
- const newAvailable = [...availableOptions];
74
- newAvailable[index].props.isSelected = !availableOptions[index].props.isSelected;
75
- setAvailableOptions(newAvailable);
76
- }
77
- };
78
-
79
- return (
80
- <DualListSelector>
81
- <DualListSelectorPane
82
- title="Available"
83
- status={`${availableOptions.filter((x) => x.props.isSelected).length} of ${
84
- availableOptions.length
85
- } options selected`}
86
- >
87
- <DualListSelectorList>
88
- {availableOptions.map((option, index) => (
89
- <DualListSelectorListItem
90
- key={index}
91
- isSelected={option.props.isSelected}
92
- id={`composable-available-option-${option.content}`}
93
- onOptionSelect={(e) => onOptionSelect(e, index, false)}
94
- >
95
- {option.content}
96
- </DualListSelectorListItem>
97
- ))}
98
- </DualListSelectorList>
99
- </DualListSelectorPane>
100
- <DualListSelectorControlsWrapper aria-label="Selector controls">
101
- <DualListSelectorControl
102
- isDisabled={!availableOptions.some((option) => option.props.isSelected)}
103
- onClick={() => moveSelected(true)}
104
- aria-label="Add selected"
105
- icon={<AngleRightIcon />}
106
- />
107
- <DualListSelectorControl
108
- isDisabled={availableOptions.length === 0}
109
- onClick={() => moveAll(true)}
110
- aria-label="Add all"
111
- icon={<AngleDoubleRightIcon />}
112
- />
113
- <DualListSelectorControl
114
- isDisabled={chosenOptions.length === 0}
115
- onClick={() => moveAll(false)}
116
- aria-label="Remove all"
117
- icon={<AngleDoubleLeftIcon />}
118
- />
119
- <DualListSelectorControl
120
- onClick={() => moveSelected(false)}
121
- isDisabled={!chosenOptions.some((option) => option.props.isSelected)}
122
- aria-label="Remove selected"
123
- icon={<AngleLeftIcon />}
124
- />
125
- </DualListSelectorControlsWrapper>
126
- <DualListSelectorPane
127
- title="Chosen"
128
- status={`${chosenOptions.filter((x) => x.props.isSelected).length} of ${chosenOptions.length} options selected`}
129
- isChosen
130
- >
131
- <DragDropSort
132
- items={chosenOptions.map((option, index) => ({
133
- ...option,
134
- props: {
135
- key: option.props.key,
136
- isSelected: option.props.isSelected,
137
- onOptionSelect: (e) => onOptionSelect(e, index, true)
138
- }
139
- }))}
140
- onDrop={(_, newItems) => {
141
- setChosenOptions(newItems);
142
- }}
143
- variant="DualListSelectorList"
144
- >
145
- <DualListSelectorList />
146
- </DragDropSort>
147
- </DualListSelectorPane>
148
- </DualListSelector>
149
- );
150
- };
@@ -1 +0,0 @@
1
- export * from './DragDropSort';
@@ -1 +0,0 @@
1
- export * from './DragDrop';
package/src/next/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components';