@patternfly/react-core 6.2.0-prerelease.3 → 6.2.0-prerelease.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/umd/assets/{output-BD6c6LL4.css → output-CFL2XnLI.css} +13474 -13473
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/demos/Skeleton.md +13 -0
- package/src/demos/examples/Skeleton/SkeletonCard.tsx +40 -0
- package/src/components/DataList/examples/DataListDraggable.tsx +0 -108
- package/src/components/DualListSelector/examples/DualListSelectorDragDrop.tsx +0 -177
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.2.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.2.0-prerelease.4","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.2.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.2.0-prerelease.4","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.2.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.2.0-prerelease.4","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.2.0-prerelease.
|
|
3
|
+
"version": "6.2.0-prerelease.5",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18",
|
|
64
64
|
"react-dom": "^17 || ^18"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "f53d2dd019b4f2aa57980fcd87b5b2e5fdde902a"
|
|
67
67
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Gallery, Flex, PageSection, Content, Card, CardBody, Skeleton } from '@patternfly/react-core';
|
|
3
|
+
import { DashboardWrapper } from '@patternfly/react-core/src/demos/DashboardWrapper';
|
|
4
|
+
|
|
5
|
+
export const SkeletonCard: React.FunctionComponent = () => {
|
|
6
|
+
const card = (index: number) => (
|
|
7
|
+
<Card key={index} isCompact>
|
|
8
|
+
<CardBody>
|
|
9
|
+
<Flex direction={{ default: 'column' }} spacer={{ default: 'spacerMd' }}>
|
|
10
|
+
<Skeleton screenreaderText="Loading content" />
|
|
11
|
+
<Skeleton width="66%" screenreaderText="Loaded 66% of content" />
|
|
12
|
+
<Skeleton width="25%" screenreaderText="Loaded 25% of content" />
|
|
13
|
+
<Skeleton width="50%" screenreaderText="Loaded 50% of content" />
|
|
14
|
+
</Flex>
|
|
15
|
+
</CardBody>
|
|
16
|
+
<CardBody>
|
|
17
|
+
<Skeleton shape="square" width="75%" screenreaderText="Loading medium square contents" />
|
|
18
|
+
</CardBody>
|
|
19
|
+
<CardBody>
|
|
20
|
+
<Flex direction={{ default: 'column' }} spacer={{ default: 'spacerMd' }}>
|
|
21
|
+
<Skeleton screenreaderText="Loading content" />
|
|
22
|
+
<Skeleton width="25%" screenreaderText="Loaded 25% of content" />
|
|
23
|
+
<Skeleton width="75%" screenreaderText="Loaded 75% of content" />
|
|
24
|
+
<Skeleton width="50%" screenreaderText="Loaded 50% of content" />
|
|
25
|
+
</Flex>
|
|
26
|
+
</CardBody>
|
|
27
|
+
</Card>
|
|
28
|
+
);
|
|
29
|
+
return (
|
|
30
|
+
<DashboardWrapper isBreadcrumbWidthLimited>
|
|
31
|
+
<PageSection isWidthLimited>
|
|
32
|
+
<Content component="h1">Main title</Content>
|
|
33
|
+
<Content component="p">This is a full page demo.</Content>
|
|
34
|
+
</PageSection>
|
|
35
|
+
<PageSection>
|
|
36
|
+
<Gallery hasGutter>{Array.from({ length: 7 }).map((_value, index) => card(index))}</Gallery>
|
|
37
|
+
</PageSection>
|
|
38
|
+
</DashboardWrapper>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
DataList,
|
|
4
|
-
DataListItem,
|
|
5
|
-
DataListCell,
|
|
6
|
-
DataListItemRow,
|
|
7
|
-
DataListCheck,
|
|
8
|
-
DataListControl,
|
|
9
|
-
DataListDragButton,
|
|
10
|
-
DataListItemCells,
|
|
11
|
-
getUniqueId
|
|
12
|
-
} from '@patternfly/react-core';
|
|
13
|
-
import { DragDrop, Draggable, Droppable } from '@patternfly/react-core/deprecated';
|
|
14
|
-
|
|
15
|
-
interface ItemType {
|
|
16
|
-
id: string;
|
|
17
|
-
content: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const getItems = (count: number) =>
|
|
21
|
-
Array.from({ length: count }, (_, idx) => idx).map((idx) => ({
|
|
22
|
-
id: `draggable-item-${idx}`,
|
|
23
|
-
content: `item ${idx} `.repeat(idx === 4 ? 20 : 1)
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
const reorder = (list: ItemType[], startIndex: number, endIndex: number) => {
|
|
27
|
-
const result = list;
|
|
28
|
-
const [removed] = result.splice(startIndex, 1);
|
|
29
|
-
result.splice(endIndex, 0, removed);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const DataListDraggable: React.FunctionComponent = () => {
|
|
34
|
-
const [items, setItems] = React.useState(getItems(10));
|
|
35
|
-
const [liveText, setLiveText] = React.useState('');
|
|
36
|
-
|
|
37
|
-
function onDrag(source) {
|
|
38
|
-
setLiveText(`Started dragging ${items[source.index].content}`);
|
|
39
|
-
// Return true to allow drag
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function onDragMove(source, dest) {
|
|
44
|
-
const newText = dest ? `Move ${items[source.index].content} to ${items[dest.index].content}` : 'Invalid drop zone';
|
|
45
|
-
if (newText !== liveText) {
|
|
46
|
-
setLiveText(newText);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function onDrop(source, dest) {
|
|
51
|
-
if (dest) {
|
|
52
|
-
const newItems = reorder(items, source.index, dest.index);
|
|
53
|
-
setItems(newItems);
|
|
54
|
-
|
|
55
|
-
setLiveText('Dragging finished.');
|
|
56
|
-
return true; // Signal that this is a valid drop and not to animate the item returning home.
|
|
57
|
-
} else {
|
|
58
|
-
setLiveText('Dragging cancelled. List unchanged.');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const uniqueId = getUniqueId();
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<DragDrop onDrag={onDrag} onDragMove={onDragMove} onDrop={onDrop}>
|
|
66
|
-
<Droppable hasNoWrapper>
|
|
67
|
-
<DataList aria-label="draggable data list example" isCompact>
|
|
68
|
-
{items.map(({ id, content }) => (
|
|
69
|
-
<Draggable key={id} hasNoWrapper>
|
|
70
|
-
<DataListItem aria-labelledby={`draggable-${id}`} ref={React.createRef()}>
|
|
71
|
-
<DataListItemRow>
|
|
72
|
-
<DataListControl>
|
|
73
|
-
<DataListDragButton
|
|
74
|
-
aria-label="Reorder"
|
|
75
|
-
aria-labelledby={`draggable-${id}`}
|
|
76
|
-
aria-describedby={`description-${uniqueId}`}
|
|
77
|
-
aria-pressed="false"
|
|
78
|
-
/>
|
|
79
|
-
<DataListCheck
|
|
80
|
-
id={`check-draggable-${id}`}
|
|
81
|
-
aria-labelledby={`draggable-${id}`}
|
|
82
|
-
name={id}
|
|
83
|
-
otherControls
|
|
84
|
-
/>
|
|
85
|
-
</DataListControl>
|
|
86
|
-
<DataListItemCells
|
|
87
|
-
dataListCells={[
|
|
88
|
-
<DataListCell key={id}>
|
|
89
|
-
<span id={`draggable-${id}`}>{content}</span>
|
|
90
|
-
</DataListCell>
|
|
91
|
-
]}
|
|
92
|
-
/>
|
|
93
|
-
</DataListItemRow>
|
|
94
|
-
</DataListItem>
|
|
95
|
-
</Draggable>
|
|
96
|
-
))}
|
|
97
|
-
</DataList>
|
|
98
|
-
</Droppable>
|
|
99
|
-
<div className="pf-v6-screen-reader" aria-live="assertive">
|
|
100
|
-
{liveText}
|
|
101
|
-
</div>
|
|
102
|
-
<div className="pf-v6-screen-reader" id={`description-${uniqueId}`}>
|
|
103
|
-
Press space or enter to begin dragging, and use the arrow keys to navigate up or down. Press enter to confirm
|
|
104
|
-
the drag, or any other key to cancel the drag operation.
|
|
105
|
-
</div>
|
|
106
|
-
</DragDrop>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
@@ -1,177 +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 { DragDrop, Draggable, Droppable, DraggableItemPosition } from '@patternfly/react-core/deprecated';
|
|
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
|
-
|
|
16
|
-
export const DualListSelectorComposableDragDrop: React.FunctionComponent = () => {
|
|
17
|
-
const [ignoreNextOptionSelect, setIgnoreNextOptionSelect] = React.useState(false);
|
|
18
|
-
const [availableOptions, setAvailableOptions] = React.useState([
|
|
19
|
-
{ text: 'Apple', selected: false, isVisible: true },
|
|
20
|
-
{ text: 'Banana', selected: false, isVisible: true },
|
|
21
|
-
{ text: 'Pineapple', selected: false, isVisible: true }
|
|
22
|
-
]);
|
|
23
|
-
const [chosenOptions, setChosenOptions] = React.useState([
|
|
24
|
-
{ text: 'Orange', selected: false, isVisible: true },
|
|
25
|
-
{ text: 'Grape', selected: false, isVisible: true },
|
|
26
|
-
{ text: 'Peach', selected: false, isVisible: true },
|
|
27
|
-
{ text: 'Strawberry', selected: false, isVisible: true }
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
|
-
const moveSelected = (fromAvailable: boolean) => {
|
|
31
|
-
const sourceOptions = fromAvailable ? availableOptions : chosenOptions;
|
|
32
|
-
const destinationOptions = fromAvailable ? chosenOptions : availableOptions;
|
|
33
|
-
for (let i = 0; i < sourceOptions.length; i++) {
|
|
34
|
-
const option = sourceOptions[i];
|
|
35
|
-
if (option.selected && option.isVisible) {
|
|
36
|
-
sourceOptions.splice(i, 1);
|
|
37
|
-
destinationOptions.push(option);
|
|
38
|
-
option.selected = false;
|
|
39
|
-
i--;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (fromAvailable) {
|
|
43
|
-
setAvailableOptions([...sourceOptions]);
|
|
44
|
-
setChosenOptions([...destinationOptions]);
|
|
45
|
-
} else {
|
|
46
|
-
setChosenOptions([...sourceOptions]);
|
|
47
|
-
setAvailableOptions([...destinationOptions]);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const moveAll = (fromAvailable: boolean) => {
|
|
52
|
-
if (fromAvailable) {
|
|
53
|
-
setChosenOptions([...availableOptions.filter((option) => option.isVisible), ...chosenOptions]);
|
|
54
|
-
setAvailableOptions([...availableOptions.filter((option) => !option.isVisible)]);
|
|
55
|
-
} else {
|
|
56
|
-
setAvailableOptions([...chosenOptions.filter((option) => option.isVisible), ...availableOptions]);
|
|
57
|
-
setChosenOptions([...chosenOptions.filter((option) => !option.isVisible)]);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const onOptionSelect = (
|
|
62
|
-
event: React.MouseEvent | React.ChangeEvent | React.KeyboardEvent,
|
|
63
|
-
index: number,
|
|
64
|
-
isChosen: boolean
|
|
65
|
-
) => {
|
|
66
|
-
if (ignoreNextOptionSelect) {
|
|
67
|
-
setIgnoreNextOptionSelect(false);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (isChosen) {
|
|
71
|
-
const newChosen = [...chosenOptions];
|
|
72
|
-
newChosen[index].selected = !chosenOptions[index].selected;
|
|
73
|
-
setChosenOptions(newChosen);
|
|
74
|
-
} else {
|
|
75
|
-
const newAvailable = [...availableOptions];
|
|
76
|
-
newAvailable[index].selected = !availableOptions[index].selected;
|
|
77
|
-
setAvailableOptions(newAvailable);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const onDrop = (source: DraggableItemPosition, dest: DraggableItemPosition | undefined) => {
|
|
82
|
-
if (dest) {
|
|
83
|
-
const newList = [...chosenOptions];
|
|
84
|
-
const [removed] = newList.splice(source.index, 1);
|
|
85
|
-
newList.splice(dest.index, 0, removed);
|
|
86
|
-
setChosenOptions(newList);
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<DualListSelector>
|
|
94
|
-
<DualListSelectorPane
|
|
95
|
-
title="Available"
|
|
96
|
-
status={`${availableOptions.filter((option) => option.selected && option.isVisible).length} of ${
|
|
97
|
-
availableOptions.filter((option) => option.isVisible).length
|
|
98
|
-
} options selected`}
|
|
99
|
-
>
|
|
100
|
-
<DualListSelectorList>
|
|
101
|
-
{availableOptions.map((option, index) =>
|
|
102
|
-
option.isVisible ? (
|
|
103
|
-
<DualListSelectorListItem
|
|
104
|
-
key={index}
|
|
105
|
-
isSelected={option.selected}
|
|
106
|
-
id={`composable-drag-drop-available-option-${index}`}
|
|
107
|
-
onOptionSelect={(e) => onOptionSelect(e, index, false)}
|
|
108
|
-
>
|
|
109
|
-
{option.text}
|
|
110
|
-
</DualListSelectorListItem>
|
|
111
|
-
) : null
|
|
112
|
-
)}
|
|
113
|
-
</DualListSelectorList>
|
|
114
|
-
</DualListSelectorPane>
|
|
115
|
-
<DualListSelectorControlsWrapper>
|
|
116
|
-
<DualListSelectorControl
|
|
117
|
-
isDisabled={!availableOptions.some((option) => option.selected)}
|
|
118
|
-
onClick={() => moveSelected(true)}
|
|
119
|
-
aria-label="Add selected"
|
|
120
|
-
icon={<AngleRightIcon />}
|
|
121
|
-
/>
|
|
122
|
-
<DualListSelectorControl
|
|
123
|
-
isDisabled={availableOptions.length === 0}
|
|
124
|
-
onClick={() => moveAll(true)}
|
|
125
|
-
aria-label="Add all"
|
|
126
|
-
icon={<AngleDoubleRightIcon />}
|
|
127
|
-
/>
|
|
128
|
-
<DualListSelectorControl
|
|
129
|
-
isDisabled={chosenOptions.length === 0}
|
|
130
|
-
onClick={() => moveAll(false)}
|
|
131
|
-
aria-label="Remove all"
|
|
132
|
-
icon={<AngleDoubleLeftIcon />}
|
|
133
|
-
/>
|
|
134
|
-
<DualListSelectorControl
|
|
135
|
-
onClick={() => moveSelected(false)}
|
|
136
|
-
isDisabled={!chosenOptions.some((option) => option.selected)}
|
|
137
|
-
aria-label="Remove selected"
|
|
138
|
-
icon={<AngleLeftIcon />}
|
|
139
|
-
/>
|
|
140
|
-
</DualListSelectorControlsWrapper>
|
|
141
|
-
<DragDrop
|
|
142
|
-
onDrag={() => {
|
|
143
|
-
setIgnoreNextOptionSelect(true);
|
|
144
|
-
return true;
|
|
145
|
-
}}
|
|
146
|
-
onDrop={onDrop}
|
|
147
|
-
>
|
|
148
|
-
<DualListSelectorPane
|
|
149
|
-
title="Chosen"
|
|
150
|
-
status={`${chosenOptions.filter((option) => option.selected && option.isVisible).length} of ${
|
|
151
|
-
chosenOptions.filter((option) => option.isVisible).length
|
|
152
|
-
} options selected`}
|
|
153
|
-
isChosen
|
|
154
|
-
>
|
|
155
|
-
<Droppable hasNoWrapper>
|
|
156
|
-
<DualListSelectorList>
|
|
157
|
-
{chosenOptions.map((option, index) =>
|
|
158
|
-
option.isVisible ? (
|
|
159
|
-
<Draggable key={index} hasNoWrapper>
|
|
160
|
-
<DualListSelectorListItem
|
|
161
|
-
isSelected={option.selected}
|
|
162
|
-
id={`composable-drag-drop-chosen-option-${index}`}
|
|
163
|
-
onOptionSelect={(e) => onOptionSelect(e, index, true)}
|
|
164
|
-
isDraggable
|
|
165
|
-
>
|
|
166
|
-
{option.text}
|
|
167
|
-
</DualListSelectorListItem>
|
|
168
|
-
</Draggable>
|
|
169
|
-
) : null
|
|
170
|
-
)}
|
|
171
|
-
</DualListSelectorList>
|
|
172
|
-
</Droppable>
|
|
173
|
-
</DualListSelectorPane>
|
|
174
|
-
</DragDrop>
|
|
175
|
-
</DualListSelector>
|
|
176
|
-
);
|
|
177
|
-
};
|