@patternfly/react-docs 7.6.0-prerelease.8 → 7.6.0-prerelease.9
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 +6 -0
- package/LICENSE +21 -0
- package/package.json +12 -11
- package/patternfly-docs/generated/components/about-modal/react.js +0 -149
- package/patternfly-docs/generated/components/accordion/react.js +0 -262
- package/patternfly-docs/generated/components/action-list/react.js +0 -144
- package/patternfly-docs/generated/components/alert/react-demos.js +0 -56
- package/patternfly-docs/generated/components/alert/react.js +0 -1433
- package/patternfly-docs/generated/components/avatar/react.js +0 -166
- package/patternfly-docs/generated/components/back-to-top/react-demos.js +0 -60
- package/patternfly-docs/generated/components/back-to-top/react.js +0 -77
- package/patternfly-docs/generated/components/backdrop/react.js +0 -64
- package/patternfly-docs/generated/components/background-image/react.js +0 -62
- package/patternfly-docs/generated/components/badge/react.js +0 -97
- package/patternfly-docs/generated/components/banner/react-demos.js +0 -57
- package/patternfly-docs/generated/components/banner/react.js +0 -148
- package/patternfly-docs/generated/components/brand/react.js +0 -142
- package/patternfly-docs/generated/components/breadcrumb/react.js +0 -206
- package/patternfly-docs/generated/components/button/react-demos.js +0 -57
- package/patternfly-docs/generated/components/button/react.js +0 -826
- package/patternfly-docs/generated/components/card/react-demos.js +0 -201
- package/patternfly-docs/generated/components/card/react.js +0 -1015
- package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +0 -1350
- package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +0 -1334
- package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +0 -1282
- package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +0 -848
- package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +0 -192
- package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +0 -426
- package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +0 -804
- package/patternfly-docs/generated/components/charts/legends/-Victory.js +0 -3230
- package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +0 -1178
- package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +0 -525
- package/patternfly-docs/generated/components/charts/patterns/-Victory.js +0 -3382
- package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +0 -377
- package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +0 -2475
- package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +0 -538
- package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +0 -1551
- package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +0 -4115
- package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +0 -955
- package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +0 -1173
- package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +0 -1166
- package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +0 -413
- package/patternfly-docs/generated/components/chip/react-deprecated.js +0 -323
- package/patternfly-docs/generated/components/clipboard-copy/react.js +0 -373
- package/patternfly-docs/generated/components/code-block/react.js +0 -148
- package/patternfly-docs/generated/components/code-editor/react.js +0 -659
- package/patternfly-docs/generated/components/compass/react-demos.js +0 -147
- package/patternfly-docs/generated/components/compass/react.js +0 -440
- package/patternfly-docs/generated/components/content/react.js +0 -248
- package/patternfly-docs/generated/components/data-list/react-demos.js +0 -90
- package/patternfly-docs/generated/components/data-list/react.js +0 -709
- package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +0 -283
- package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +0 -64
- package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +0 -83
- package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +0 -395
- package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +0 -241
- package/patternfly-docs/generated/components/description-list/react-demos.js +0 -58
- package/patternfly-docs/generated/components/description-list/react.js +0 -743
- package/patternfly-docs/generated/components/divider/react.js +0 -126
- package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +0 -351
- package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +0 -184
- package/patternfly-docs/generated/components/drag-and-drop/react.js +0 -137
- package/patternfly-docs/generated/components/drawer/react.js +0 -598
- package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +0 -772
- package/patternfly-docs/generated/components/dual-list-selector/react.js +0 -594
- package/patternfly-docs/generated/components/empty-state/react.js +0 -199
- package/patternfly-docs/generated/components/expandable-section/react-demos.js +0 -65
- package/patternfly-docs/generated/components/expandable-section/react.js +0 -408
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +0 -52
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +0 -398
- package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +0 -749
- package/patternfly-docs/generated/components/forms/checkbox/react.js +0 -222
- package/patternfly-docs/generated/components/forms/form/react.js +0 -1106
- package/patternfly-docs/generated/components/forms/form-select/react.js +0 -208
- package/patternfly-docs/generated/components/forms/radio/react.js +0 -212
- package/patternfly-docs/generated/components/forms/text-area/react.js +0 -160
- package/patternfly-docs/generated/components/forms/text-input/react.js +0 -216
- package/patternfly-docs/generated/components/helper-text/react-demos.js +0 -180
- package/patternfly-docs/generated/components/helper-text/react.js +0 -164
- package/patternfly-docs/generated/components/hero/react.js +0 -88
- package/patternfly-docs/generated/components/hint/react.js +0 -169
- package/patternfly-docs/generated/components/icon/react.js +0 -215
- package/patternfly-docs/generated/components/input-group/react.js +0 -182
- package/patternfly-docs/generated/components/jump-links/react-demos.js +0 -154
- package/patternfly-docs/generated/components/jump-links/react.js +0 -212
- package/patternfly-docs/generated/components/label/react-demos.js +0 -57
- package/patternfly-docs/generated/components/label/react.js +0 -417
- package/patternfly-docs/generated/components/list/react.js +0 -175
- package/patternfly-docs/generated/components/login-page/react.js +0 -587
- package/patternfly-docs/generated/components/masthead/react-demos.js +0 -79
- package/patternfly-docs/generated/components/masthead/react.js +0 -291
- package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +0 -769
- package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +0 -665
- package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +0 -187
- package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +0 -163
- package/patternfly-docs/generated/components/menus/dropdown/react.js +0 -998
- package/patternfly-docs/generated/components/menus/menu/react.js +0 -1540
- package/patternfly-docs/generated/components/menus/menu-toggle/react.js +0 -747
- package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +0 -508
- package/patternfly-docs/generated/components/menus/select/react-templates.js +0 -257
- package/patternfly-docs/generated/components/menus/select/react.js +0 -998
- package/patternfly-docs/generated/components/modal/react-deprecated.js +0 -554
- package/patternfly-docs/generated/components/modal/react.js +0 -597
- package/patternfly-docs/generated/components/navigation/react-demos.js +0 -356
- package/patternfly-docs/generated/components/navigation/react.js +0 -409
- package/patternfly-docs/generated/components/notification-badge/react.js +0 -196
- package/patternfly-docs/generated/components/notification-drawer/react-demos.js +0 -107
- package/patternfly-docs/generated/components/notification-drawer/react.js +0 -394
- package/patternfly-docs/generated/components/number-input/react.js +0 -210
- package/patternfly-docs/generated/components/overflow-menu/react.js +0 -274
- package/patternfly-docs/generated/components/page/react-demos.js +0 -149
- package/patternfly-docs/generated/components/page/react.js +0 -1352
- package/patternfly-docs/generated/components/pagination/react.js +0 -492
- package/patternfly-docs/generated/components/panel/react.js +0 -236
- package/patternfly-docs/generated/components/popover/react.js +0 -390
- package/patternfly-docs/generated/components/progress/react-demos.js +0 -59
- package/patternfly-docs/generated/components/progress/react.js +0 -283
- package/patternfly-docs/generated/components/progress-stepper/react-demos.js +0 -45
- package/patternfly-docs/generated/components/progress-stepper/react.js +0 -219
- package/patternfly-docs/generated/components/search-input/react-demos.js +0 -113
- package/patternfly-docs/generated/components/search-input/react.js +0 -263
- package/patternfly-docs/generated/components/sidebar/react.js +0 -236
- package/patternfly-docs/generated/components/simple-list/react.js +0 -200
- package/patternfly-docs/generated/components/skeleton/react-demos.js +0 -44
- package/patternfly-docs/generated/components/skeleton/react.js +0 -122
- package/patternfly-docs/generated/components/skip-to-content/react.js +0 -73
- package/patternfly-docs/generated/components/slider/react.js +0 -309
- package/patternfly-docs/generated/components/spinner/react.js +0 -111
- package/patternfly-docs/generated/components/switch/react.js +0 -163
- package/patternfly-docs/generated/components/table/react-demos.js +0 -355
- package/patternfly-docs/generated/components/table/react-deprecated.js +0 -1350
- package/patternfly-docs/generated/components/table/react.js +0 -3241
- package/patternfly-docs/generated/components/tabs/react-demos.js +0 -108
- package/patternfly-docs/generated/components/tabs/react.js +0 -1359
- package/patternfly-docs/generated/components/text-input-group/react-demos.js +0 -152
- package/patternfly-docs/generated/components/text-input-group/react.js +0 -278
- package/patternfly-docs/generated/components/tile/react-deprecated.js +0 -242
- package/patternfly-docs/generated/components/timestamp/react.js +0 -283
- package/patternfly-docs/generated/components/title/react.js +0 -94
- package/patternfly-docs/generated/components/toggle-group/react.js +0 -299
- package/patternfly-docs/generated/components/toolbar/react-demos.js +0 -66
- package/patternfly-docs/generated/components/toolbar/react.js +0 -932
- package/patternfly-docs/generated/components/tooltip/react.js +0 -241
- package/patternfly-docs/generated/components/tree-view/react.js +0 -429
- package/patternfly-docs/generated/components/truncate/react.js +0 -211
- package/patternfly-docs/generated/components/wizard/react-demos.js +0 -87
- package/patternfly-docs/generated/components/wizard/react-deprecated.js +0 -788
- package/patternfly-docs/generated/components/wizard/react.js +0 -986
- package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +0 -285
- package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +0 -70
- package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +0 -506
- package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +0 -94
- package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +0 -272
- package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +0 -87
- package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +0 -124
- package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +0 -112
- package/patternfly-docs/generated/index.js +0 -1769
- package/patternfly-docs/generated/patterns/card-view/react-demos.js +0 -78
- package/patternfly-docs/generated/patterns/filters/react-demos.js +0 -141
- package/patternfly-docs/generated/patterns/password-generator/react-demos.js +0 -51
- package/patternfly-docs/generated/patterns/password-strength/react-demos.js +0 -61
- package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +0 -124
- package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +0 -81
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
-
|
|
4
|
-
const pageData = {
|
|
5
|
-
"id": "Divider",
|
|
6
|
-
"section": "components",
|
|
7
|
-
"subsection": "",
|
|
8
|
-
"deprecated": false,
|
|
9
|
-
"template": false,
|
|
10
|
-
"beta": false,
|
|
11
|
-
"demo": false,
|
|
12
|
-
"newImplementationLink": false,
|
|
13
|
-
"source": "react",
|
|
14
|
-
"tabName": null,
|
|
15
|
-
"slug": "/components/divider/react",
|
|
16
|
-
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Divider/examples/Divider.md",
|
|
17
|
-
"relPath": "packages/react-core/src/components/Divider/examples/Divider.md",
|
|
18
|
-
"propComponents": [
|
|
19
|
-
{
|
|
20
|
-
"name": "Divider",
|
|
21
|
-
"description": "",
|
|
22
|
-
"props": [
|
|
23
|
-
{
|
|
24
|
-
"name": "className",
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "Additional classes added to the divider"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"name": "component",
|
|
30
|
-
"type": "'hr' | 'li' | 'div'",
|
|
31
|
-
"description": "The component type to use",
|
|
32
|
-
"defaultValue": "DividerVariant.hr"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"name": "inset",
|
|
36
|
-
"type": "{\n default?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl';\n sm?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl';\n md?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl';\n lg?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl';\n xl?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl';\n '2xl'?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl';\n}",
|
|
37
|
-
"description": "Insets at various breakpoints."
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "orientation",
|
|
41
|
-
"type": "{\n default?: 'vertical' | 'horizontal';\n sm?: 'vertical' | 'horizontal';\n md?: 'vertical' | 'horizontal';\n lg?: 'vertical' | 'horizontal';\n xl?: 'vertical' | 'horizontal';\n '2xl'?: 'vertical' | 'horizontal';\n}",
|
|
42
|
-
"description": "Indicates how the divider will display at various breakpoints. Vertical divider must be in a flex layout."
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"name": "role",
|
|
46
|
-
"type": "'separator' | 'presentation'",
|
|
47
|
-
"description": "The ARIA role of the divider when the component property has a value other than \"hr\".",
|
|
48
|
-
"defaultValue": "'separator'"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"cssPrefix": [
|
|
54
|
-
"pf-v6-c-divider"
|
|
55
|
-
],
|
|
56
|
-
"examples": [
|
|
57
|
-
"Using hr",
|
|
58
|
-
"Using li",
|
|
59
|
-
"Using div",
|
|
60
|
-
"Inset medium",
|
|
61
|
-
"Inset at various breakpoints",
|
|
62
|
-
"Vertical in flex layout",
|
|
63
|
-
"Vertical in flex layout, inset small",
|
|
64
|
-
"Vertical in flex layout, inset at various breakpoints",
|
|
65
|
-
"Switch orientation at various breakpoints"
|
|
66
|
-
]
|
|
67
|
-
};
|
|
68
|
-
pageData.examples = {
|
|
69
|
-
'Using hr': props =>
|
|
70
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider } from '@patternfly/react-core';\n\nexport const DividerUsingHr: React.FunctionComponent = () => <Divider />;\n","title":"Using hr","lang":"ts","className":""}}>
|
|
71
|
-
|
|
72
|
-
</Example>,
|
|
73
|
-
'Using li': props =>
|
|
74
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider } from '@patternfly/react-core';\n\nexport const DividerUsingLi: React.FunctionComponent = () => (\n <ul role=\"list\">\n <li>List item one</li>\n <Divider component=\"li\" role=\"none\" />\n <li>List item two</li>\n </ul>\n);\n","title":"Using li","lang":"ts","className":""}}>
|
|
75
|
-
|
|
76
|
-
</Example>,
|
|
77
|
-
'Using div': props =>
|
|
78
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider } from '@patternfly/react-core';\n\nexport const DividerUsingDiv: React.FunctionComponent = () => <Divider component=\"div\" />;\n","title":"Using div","lang":"ts","className":""}}>
|
|
79
|
-
|
|
80
|
-
</Example>,
|
|
81
|
-
'Inset medium': props =>
|
|
82
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider } from '@patternfly/react-core';\n\nexport const DividerInsetMedium: React.FunctionComponent = () => <Divider inset={{ default: 'insetMd' }} />;\n","title":"Inset medium","lang":"ts","className":""}}>
|
|
83
|
-
|
|
84
|
-
</Example>,
|
|
85
|
-
'Inset at various breakpoints': props =>
|
|
86
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider } from '@patternfly/react-core';\n\nexport const DividerInsetVariousBreakpoints: React.FunctionComponent = () => (\n <Divider\n inset={{\n default: 'insetMd',\n md: 'insetNone',\n lg: 'inset3xl',\n xl: 'insetLg'\n }}\n />\n);\n","title":"Inset at various breakpoints","lang":"ts","className":""}}>
|
|
87
|
-
|
|
88
|
-
</Example>,
|
|
89
|
-
'Vertical in flex layout': props =>
|
|
90
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider, Flex, FlexItem } from '@patternfly/react-core';\n\nexport const DividerVerticalFlex: React.FunctionComponent = () => (\n <Flex>\n <FlexItem>first item</FlexItem>\n <Divider\n orientation={{\n default: 'vertical'\n }}\n />\n <FlexItem>second item</FlexItem>\n </Flex>\n);\n","title":"Vertical in flex layout","lang":"ts","className":""}}>
|
|
91
|
-
|
|
92
|
-
</Example>,
|
|
93
|
-
'Vertical in flex layout, inset small': props =>
|
|
94
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider, Flex, FlexItem } from '@patternfly/react-core';\n\nexport const DividerVerticalFlexInsetSmall: React.FunctionComponent = () => (\n <Flex>\n <FlexItem>first item</FlexItem>\n <Divider\n orientation={{\n default: 'vertical'\n }}\n inset={{ default: 'insetSm' }}\n />\n <FlexItem>second item</FlexItem>\n </Flex>\n);\n","title":"Vertical in flex layout, inset small","lang":"ts","className":""}}>
|
|
95
|
-
|
|
96
|
-
</Example>,
|
|
97
|
-
'Vertical in flex layout, inset at various breakpoints': props =>
|
|
98
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider, Flex, FlexItem } from '@patternfly/react-core';\n\nexport const DividerVerticalFlexInsetVariousBreakpoints: React.FunctionComponent = () => (\n <Flex>\n <FlexItem>first item</FlexItem>\n <Divider\n orientation={{\n default: 'vertical'\n }}\n inset={{\n default: 'insetMd',\n md: 'insetNone',\n lg: 'insetSm',\n xl: 'insetXs'\n }}\n />\n <FlexItem>second item</FlexItem>\n </Flex>\n);\n","title":"Vertical in flex layout, inset at various breakpoints","lang":"ts","className":""}}>
|
|
99
|
-
|
|
100
|
-
</Example>,
|
|
101
|
-
'Switch orientation at various breakpoints': props =>
|
|
102
|
-
<Example {...pageData} {...props} {...{"code":"import { Divider, Flex, FlexItem } from '@patternfly/react-core';\n\nexport const DividerOrientationVariousBreakpoints: React.FunctionComponent = () => (\n <Flex>\n <FlexItem>first item</FlexItem>\n <Divider\n orientation={{\n default: 'vertical',\n sm: 'horizontal',\n md: 'vertical',\n lg: 'horizontal',\n xl: 'vertical',\n '2xl': 'horizontal'\n }}\n />\n <FlexItem>second item</FlexItem>\n </Flex>\n);\n","title":"Switch orientation at various breakpoints","lang":"ts","className":""}}>
|
|
103
|
-
|
|
104
|
-
</Example>
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const Component = () => (
|
|
108
|
-
<React.Fragment>
|
|
109
|
-
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
110
|
-
{`Examples`}
|
|
111
|
-
</AutoLinkHeader>
|
|
112
|
-
{React.createElement(pageData.examples["Using hr"])}
|
|
113
|
-
{React.createElement(pageData.examples["Using li"])}
|
|
114
|
-
{React.createElement(pageData.examples["Using div"])}
|
|
115
|
-
{React.createElement(pageData.examples["Inset medium"])}
|
|
116
|
-
{React.createElement(pageData.examples["Inset at various breakpoints"])}
|
|
117
|
-
{React.createElement(pageData.examples["Vertical in flex layout"])}
|
|
118
|
-
{React.createElement(pageData.examples["Vertical in flex layout, inset small"])}
|
|
119
|
-
{React.createElement(pageData.examples["Vertical in flex layout, inset at various breakpoints"])}
|
|
120
|
-
{React.createElement(pageData.examples["Switch orientation at various breakpoints"])}
|
|
121
|
-
</React.Fragment>
|
|
122
|
-
);
|
|
123
|
-
Component.displayName = 'ComponentsDividerReactDocs';
|
|
124
|
-
Component.pageData = pageData;
|
|
125
|
-
|
|
126
|
-
export default Component;
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import RhMicronsDoubleCaretLeftIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-double-caret-left-icon';
|
|
5
|
-
import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
|
|
6
|
-
import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';
|
|
7
|
-
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
8
|
-
import { DragDropSort, DragDropContainer, Droppable as NewDroppable } from '@patternfly/react-drag-drop';
|
|
9
|
-
const pageData = {
|
|
10
|
-
"id": "Drag and drop",
|
|
11
|
-
"section": "components",
|
|
12
|
-
"subsection": "",
|
|
13
|
-
"deprecated": false,
|
|
14
|
-
"template": false,
|
|
15
|
-
"beta": false,
|
|
16
|
-
"demo": false,
|
|
17
|
-
"newImplementationLink": false,
|
|
18
|
-
"source": "react-demos",
|
|
19
|
-
"tabName": null,
|
|
20
|
-
"slug": "/components/drag-and-drop/react-demos",
|
|
21
|
-
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-drag-drop/src/components/DragDrop/examples/DragDropDemos.md",
|
|
22
|
-
"relPath": "packages/react-drag-drop/src/components/DragDrop/examples/DragDropDemos.md",
|
|
23
|
-
"propComponents": [
|
|
24
|
-
{
|
|
25
|
-
"name": "DragDropSort",
|
|
26
|
-
"description": "DragDropSortProps extends dnd-kit's props which may be viewed at https://docs.dndkit.com/api-documentation/context-provider#props.",
|
|
27
|
-
"props": [
|
|
28
|
-
{
|
|
29
|
-
"name": "children",
|
|
30
|
-
"type": "React.ReactElement<any>",
|
|
31
|
-
"description": "Custom defined content wrapper for draggable items. By default, draggable items are wrapped in a styled div.\nIntended to be a 'DataList' or 'DualListSelectorList' without children."
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "items",
|
|
35
|
-
"type": "DraggableObject[]",
|
|
36
|
-
"description": "Sorted array of draggable objects",
|
|
37
|
-
"required": true
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "onDrag",
|
|
41
|
-
"type": "(event: DragDropSortDragStartEvent, oldIndex: number) => void",
|
|
42
|
-
"description": "Callback when use begins dragging a draggable object",
|
|
43
|
-
"defaultValue": "() => {}"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"name": "onDrop",
|
|
47
|
-
"type": "(event: DragDropSortDragEndEvent, items: DraggableObject[], oldIndex?: number, newIndex?: number) => void",
|
|
48
|
-
"description": "Callback when user drops a draggable object",
|
|
49
|
-
"defaultValue": "() => {}"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"name": "overlayProps",
|
|
53
|
-
"type": "any",
|
|
54
|
-
"description": "Additional classes to apply to the drag overlay"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"name": "variant",
|
|
58
|
-
"type": "'default' | 'DataList' | 'DualListSelectorList'",
|
|
59
|
-
"description": "The variant determines which component wraps the draggable object.\nDefault variant wraps the draggable object in a div.\nDataList variant wraps the draggable object in a DataListItem\nDualListSelectorList variant wraps the draggable objects in a DualListSelectorListItem and a div.pf-c-dual-list-selector__item-text element",
|
|
60
|
-
"defaultValue": "'default'"
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "DraggableObject",
|
|
66
|
-
"description": "",
|
|
67
|
-
"props": [
|
|
68
|
-
{
|
|
69
|
-
"name": "content",
|
|
70
|
-
"type": "React.ReactNode",
|
|
71
|
-
"description": "Content rendered in the draggable object",
|
|
72
|
-
"required": true
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"name": "id",
|
|
76
|
-
"type": "string | number",
|
|
77
|
-
"description": "Unique id of the draggable object",
|
|
78
|
-
"required": true
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"name": "props",
|
|
82
|
-
"type": "any",
|
|
83
|
-
"description": "Props spread to the rendered wrapper of the draggable object"
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
"examples": [
|
|
89
|
-
"Drag and drop sortable data list",
|
|
90
|
-
"Drag and drop sortable dual list selector",
|
|
91
|
-
"Data list",
|
|
92
|
-
"Dual list selector"
|
|
93
|
-
]
|
|
94
|
-
};
|
|
95
|
-
pageData.liveContext = {
|
|
96
|
-
useEffect,
|
|
97
|
-
useState,
|
|
98
|
-
RhMicronsDoubleCaretLeftIcon,
|
|
99
|
-
AngleLeftIcon,
|
|
100
|
-
AngleDoubleRightIcon,
|
|
101
|
-
AngleRightIcon,
|
|
102
|
-
DragDropSort,
|
|
103
|
-
DragDropContainer,
|
|
104
|
-
NewDroppable
|
|
105
|
-
};
|
|
106
|
-
pageData.examples = {
|
|
107
|
-
'Drag and drop sortable data list': props =>
|
|
108
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { DataList, DataListCell, DataListCheck, DataListControl, DataListItemCells } from '@patternfly/react-core';\nimport { DragDropSort, DraggableObject } from '@patternfly/react-drag-drop';\n\nconst getItems = (count: number): DraggableObject[] =>\n Array.from({ length: count }, (_, idx) => idx).map((idx) => ({\n id: `data-list-item-${idx}`,\n content: (\n <>\n <DataListControl>\n <DataListCheck id={`check-drag-${idx}`} aria-labelledby={`item-${idx}`} name={`item-${idx}`} otherControls />\n </DataListControl>\n <DataListItemCells\n dataListCells={[\n <DataListCell key={`item-${idx}`}>\n <span id={`item-${idx}`}>{`item-${idx}`}</span>\n </DataListCell>\n ]}\n />\n </>\n )\n }));\n\nexport const DataListDraggable: React.FunctionComponent = (props) => {\n const [items, setItems] = useState<DraggableObject[]>(getItems(10));\n\n return (\n <DragDropSort\n items={items}\n onDrop={(_, newItems) => {\n setItems(newItems);\n }}\n variant=\"DataList\"\n overlayProps={{ isCompact: true }}\n >\n <DataList aria-label=\"draggable data list example\" isCompact {...props} />\n </DragDropSort>\n );\n};\n","title":"Drag and drop sortable data list","lang":"ts","className":""}}>
|
|
109
|
-
|
|
110
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
111
|
-
{`To enable reordering in a `}
|
|
112
|
-
|
|
113
|
-
<code {...{"className":"ws-code "}}>
|
|
114
|
-
{`<DataList>`}
|
|
115
|
-
</code>
|
|
116
|
-
{`, wrap the `}
|
|
117
|
-
|
|
118
|
-
<code {...{"className":"ws-code "}}>
|
|
119
|
-
{`<DataList>`}
|
|
120
|
-
</code>
|
|
121
|
-
{` component with `}
|
|
122
|
-
|
|
123
|
-
<code {...{"className":"ws-code "}}>
|
|
124
|
-
{`<DragDropSort>`}
|
|
125
|
-
</code>
|
|
126
|
-
{` and define the `}
|
|
127
|
-
|
|
128
|
-
<code {...{"className":"ws-code "}}>
|
|
129
|
-
{`variant`}
|
|
130
|
-
</code>
|
|
131
|
-
{` as "DataList".`}
|
|
132
|
-
</p>
|
|
133
|
-
</Example>,
|
|
134
|
-
'Drag and drop sortable dual list selector': props =>
|
|
135
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n DualListSelector,\n DualListSelectorPane,\n DualListSelectorList,\n DualListSelectorListItem,\n DualListSelectorControlsWrapper,\n DualListSelectorControl\n} from '@patternfly/react-core';\nimport { DragDropSort, DraggableObject } from '@patternfly/react-drag-drop';\n\nimport RhMicronsDoubleCaretLeftIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-double-caret-left-icon';\nimport AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';\nimport AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';\nimport AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';\n\nexport const ComposableDualListSelector: React.FunctionComponent = () => {\n const [ignoreNextOptionSelect, setIgnoreNextOptionSelect] = useState(false);\n const [availableOptions, setAvailableOptions] = useState<DraggableObject[]>([\n { id: 'Apple', content: 'Apple', props: { key: 'Apple', isSelected: false } },\n { id: 'Banana', content: 'Banana', props: { key: 'Banana', isSelected: false } },\n { id: 'Pineapple', content: 'Pineapple', props: { key: 'Pineapple', isSelected: false } }\n ]);\n\n const [chosenOptions, setChosenOptions] = useState<DraggableObject[]>([\n { id: 'Orange', content: 'Orange', props: { key: 'Orange', isSelected: false } },\n { id: 'Grape', content: 'Grape', props: { key: 'Grape', isSelected: false } },\n { id: 'Peach', content: 'Peach', props: { key: 'Peach', isSelected: false } },\n { id: 'Strawberry', content: 'Strawberry', props: { key: 'Strawberry', isSelected: false } }\n ]);\n\n const moveSelected = (fromAvailable) => {\n const sourceOptions = fromAvailable ? availableOptions : chosenOptions;\n const destinationOptions = fromAvailable ? chosenOptions : availableOptions;\n for (let i = 0; i < sourceOptions.length; i++) {\n const option = sourceOptions[i];\n if (option.props.isSelected) {\n sourceOptions.splice(i, 1);\n destinationOptions.push(option);\n option.props.isSelected = false;\n i--;\n }\n }\n if (fromAvailable) {\n setAvailableOptions([...sourceOptions]);\n setChosenOptions([...destinationOptions]);\n } else {\n setChosenOptions([...sourceOptions]);\n setAvailableOptions([...destinationOptions]);\n }\n };\n\n const moveAll = (fromAvailable) => {\n if (fromAvailable) {\n setChosenOptions([...availableOptions, ...chosenOptions]);\n setAvailableOptions([]);\n } else {\n setAvailableOptions([...chosenOptions, ...availableOptions]);\n setChosenOptions([]);\n }\n };\n\n const onOptionSelect = (event, index, isChosen) => {\n if (ignoreNextOptionSelect) {\n setIgnoreNextOptionSelect(false);\n return;\n }\n if (isChosen) {\n const newChosen = [...chosenOptions];\n newChosen[index].props.isSelected = !chosenOptions[index].props.isSelected;\n setChosenOptions(newChosen);\n } else {\n const newAvailable = [...availableOptions];\n newAvailable[index].props.isSelected = !availableOptions[index].props.isSelected;\n setAvailableOptions(newAvailable);\n }\n };\n\n return (\n <DualListSelector>\n <DualListSelectorPane\n title=\"Available\"\n status={`${availableOptions.filter((x) => x.props.isSelected).length} of ${\n availableOptions.length\n } options selected`}\n >\n <DualListSelectorList>\n {availableOptions.map((option, index) => (\n <DualListSelectorListItem\n key={index}\n isSelected={option.props.isSelected}\n id={`composable-available-option-${option.content}`}\n onOptionSelect={(e) => onOptionSelect(e, index, false)}\n >\n {option.content}\n </DualListSelectorListItem>\n ))}\n </DualListSelectorList>\n </DualListSelectorPane>\n <DualListSelectorControlsWrapper aria-label=\"Selector controls\">\n <DualListSelectorControl\n isDisabled={!availableOptions.some((option) => option.props.isSelected)}\n onClick={() => moveSelected(true)}\n aria-label=\"Add selected\"\n icon={<AngleRightIcon />}\n />\n <DualListSelectorControl\n isDisabled={availableOptions.length === 0}\n onClick={() => moveAll(true)}\n aria-label=\"Add all\"\n icon={<AngleDoubleRightIcon />}\n />\n <DualListSelectorControl\n isDisabled={chosenOptions.length === 0}\n onClick={() => moveAll(false)}\n aria-label=\"Remove all\"\n icon={<RhMicronsDoubleCaretLeftIcon />}\n />\n <DualListSelectorControl\n onClick={() => moveSelected(false)}\n isDisabled={!chosenOptions.some((option) => option.props.isSelected)}\n aria-label=\"Remove selected\"\n icon={<AngleLeftIcon />}\n />\n </DualListSelectorControlsWrapper>\n <DualListSelectorPane\n title=\"Chosen\"\n status={`${chosenOptions.filter((x) => x.props.isSelected).length} of ${chosenOptions.length} options selected`}\n isChosen\n >\n <DragDropSort\n items={chosenOptions.map((option, index) => ({\n ...option,\n props: {\n key: option.props.key,\n isSelected: option.props.isSelected,\n onOptionSelect: (e) => onOptionSelect(e, index, true)\n }\n }))}\n onDrop={(_, newItems) => {\n setChosenOptions(newItems);\n }}\n variant=\"DualListSelectorList\"\n >\n <DualListSelectorList />\n </DragDropSort>\n </DualListSelectorPane>\n </DualListSelector>\n );\n};\n","title":"Drag and drop sortable dual list selector","lang":"ts","className":""}}>
|
|
136
|
-
|
|
137
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
138
|
-
{`To enable reordering in a `}
|
|
139
|
-
|
|
140
|
-
<code {...{"className":"ws-code "}}>
|
|
141
|
-
{`<DualListSelector>`}
|
|
142
|
-
</code>
|
|
143
|
-
{` pane wrap the `}
|
|
144
|
-
|
|
145
|
-
<code {...{"className":"ws-code "}}>
|
|
146
|
-
{`<DualListSelectorList>`}
|
|
147
|
-
</code>
|
|
148
|
-
{` component with `}
|
|
149
|
-
|
|
150
|
-
<code {...{"className":"ws-code "}}>
|
|
151
|
-
{`<DragDropSort>`}
|
|
152
|
-
</code>
|
|
153
|
-
{` and define the `}
|
|
154
|
-
|
|
155
|
-
<code {...{"className":"ws-code "}}>
|
|
156
|
-
{`variant`}
|
|
157
|
-
</code>
|
|
158
|
-
{` as "DualListSelectorList".`}
|
|
159
|
-
</p>
|
|
160
|
-
</Example>,
|
|
161
|
-
'Data list': props =>
|
|
162
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n DataList,\n DataListCell,\n DataListCheck,\n DataListControl,\n DataListItemCells,\n Grid,\n GridItem\n} from '@patternfly/react-core';\nimport { DragDropContainer, DraggableObject, Droppable as NewDroppable } from '@patternfly/react-drag-drop';\n\nconst getItems = (from: number, count: number): DraggableObject[] =>\n Array.from({ length: count }, (_, idx) => from + idx).map((idx) => ({\n id: `data-list-item-${idx}`,\n content: (\n <>\n <DataListControl>\n <DataListCheck\n id={`check-dragdrop=${idx}`}\n aria-labelledby={`item-${idx}`}\n name={`item-${idx}`}\n otherControls\n />\n </DataListControl>\n <DataListItemCells\n dataListCells={[\n <DataListCell key={`item-${idx}`}>\n <span id={`item-${idx}`}>{`item-${idx}`}</span>\n </DataListCell>\n ]}\n />\n </>\n )\n }));\n\nexport const DataListDraggable: React.FunctionComponent = (props) => {\n const [items, setItems] = useState<Record<string, DraggableObject[]>>({\n group1: getItems(0, 5),\n group2: getItems(5, 5)\n });\n\n return (\n <DragDropContainer\n items={items}\n onDrop={(_, newItems) => {\n setItems(newItems);\n }}\n onContainerMove={(_, newItems) => {\n setItems(newItems);\n }}\n onCancel={(_, prevItems) => {\n setItems(prevItems);\n }}\n variant=\"DataList\"\n overlayProps={{ isCompact: true }}\n >\n <Grid hasGutter>\n <GridItem span={6}>\n <h1>group 1</h1>\n <NewDroppable\n id=\"group1\"\n items={items.group1}\n variant=\"DataList\"\n wrapper={<DataList aria-label=\"draggable data list example\" isCompact {...props} />}\n />\n </GridItem>\n <GridItem span={6}>\n <h1>group 2</h1>\n <NewDroppable\n id=\"group2\"\n items={items.group2}\n variant=\"DataList\"\n wrapper={<DataList aria-label=\"draggable data list example\" isCompact {...props} />}\n />\n </GridItem>\n </Grid>\n </DragDropContainer>\n );\n};\n","title":"Data list","lang":"ts","className":""}}>
|
|
163
|
-
|
|
164
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
165
|
-
{`To enable multiple drop zones with `}
|
|
166
|
-
|
|
167
|
-
<code {...{"className":"ws-code "}}>
|
|
168
|
-
{`<DataList>`}
|
|
169
|
-
</code>
|
|
170
|
-
{` components, place one or more `}
|
|
171
|
-
|
|
172
|
-
<code {...{"className":"ws-code "}}>
|
|
173
|
-
{`<Droppable>`}
|
|
174
|
-
</code>
|
|
175
|
-
{` within `}
|
|
176
|
-
|
|
177
|
-
<code {...{"className":"ws-code "}}>
|
|
178
|
-
{`<DragDropContainer>`}
|
|
179
|
-
</code>
|
|
180
|
-
{` and define the `}
|
|
181
|
-
|
|
182
|
-
<code {...{"className":"ws-code "}}>
|
|
183
|
-
{`variant`}
|
|
184
|
-
</code>
|
|
185
|
-
{` on all components as "DataList".`}
|
|
186
|
-
</p>
|
|
187
|
-
</Example>,
|
|
188
|
-
'Dual list selector': props =>
|
|
189
|
-
<Example {...pageData} {...props} {...{"code":"import { useEffect, useState } from 'react';\nimport {\n DualListSelector,\n DualListSelectorPane,\n DualListSelectorList,\n DualListSelectorControlsWrapper,\n DualListSelectorControl\n} from '@patternfly/react-core';\nimport { DragDropContainer, DraggableObject, Droppable as NewDroppable } from '@patternfly/react-drag-drop';\n\nimport RhMicronsDoubleCaretLeftIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-double-caret-left-icon';\nimport AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';\nimport AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';\nimport AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';\n\nexport const DragDropContainerDualListSelector: React.FunctionComponent = () => {\n const [ignoreNextOptionSelect, setIgnoreNextOptionSelect] = useState(false);\n const [availableOptions, setAvailableOptions] = useState<DraggableObject[]>([\n { id: 'Apple', content: 'Apple', props: { key: 'Apple', isSelected: false } },\n { id: 'Banana', content: 'Banana', props: { key: 'Banana', isSelected: false } },\n { id: 'Pineapple', content: 'Pineapple', props: { key: 'Pineapple', isSelected: false } }\n ]);\n\n const [chosenOptions, setChosenOptions] = useState<DraggableObject[]>([\n { id: 'Orange', content: 'Orange', props: { key: 'Orange', isSelected: false } },\n { id: 'Grape', content: 'Grape', props: { key: 'Grape', isSelected: false } },\n { id: 'Peach', content: 'Peach', props: { key: 'Peach', isSelected: false } },\n { id: 'Strawberry', content: 'Strawberry', props: { key: 'Strawberry', isSelected: false } }\n ]);\n\n const [allDraggableItems, setAllItems] = useState<Record<string, DraggableObject[]>>({\n available: availableOptions.map((option, index) => ({\n ...option,\n props: {\n key: option.props.key,\n isSelected: option.props.isSelected,\n onOptionSelect: (e) => onOptionSelect(e, index, false)\n }\n })),\n chosen: chosenOptions.map((option, index) => ({\n ...option,\n props: {\n key: option.props.key,\n isSelected: option.props.isSelected,\n onOptionSelect: (e) => onOptionSelect(e, index, true)\n }\n }))\n });\n\n const handleDragOperation = (_event: any, items: Record<string, DraggableObject[]>) => {\n setAvailableOptions(items.available);\n setChosenOptions(items.chosen);\n setAllItems(items);\n };\n\n useEffect(() => {\n setAllItems({\n available: availableOptions.map((option, index) => ({\n ...option,\n props: {\n key: option.props.key,\n isSelected: option.props.isSelected,\n onOptionSelect: (e) => onOptionSelect(e, index, false)\n }\n })),\n chosen: chosenOptions.map((option, index) => ({\n ...option,\n props: {\n key: option.props.key,\n isSelected: option.props.isSelected,\n onOptionSelect: (e) => onOptionSelect(e, index, true)\n }\n }))\n });\n }, [availableOptions, chosenOptions]);\n\n const moveSelected = (fromAvailable) => {\n const sourceOptions = fromAvailable ? availableOptions : chosenOptions;\n const destinationOptions = fromAvailable ? chosenOptions : availableOptions;\n for (let i = 0; i < sourceOptions.length; i++) {\n const option = sourceOptions[i];\n if (option.props.isSelected) {\n sourceOptions.splice(i, 1);\n destinationOptions.push(option);\n option.props.isSelected = false;\n i--;\n }\n }\n if (fromAvailable) {\n setAvailableOptions([...sourceOptions]);\n setChosenOptions([...destinationOptions]);\n } else {\n setChosenOptions([...sourceOptions]);\n setAvailableOptions([...destinationOptions]);\n }\n };\n\n const moveAll = (fromAvailable) => {\n if (fromAvailable) {\n setChosenOptions([...availableOptions, ...chosenOptions]);\n setAvailableOptions([]);\n } else {\n setAvailableOptions([...chosenOptions, ...availableOptions]);\n setChosenOptions([]);\n }\n };\n\n const onOptionSelect = (event, index, isChosen) => {\n if (ignoreNextOptionSelect) {\n setIgnoreNextOptionSelect(false);\n return;\n }\n if (isChosen) {\n const newChosen = [...chosenOptions];\n newChosen[index].props.isSelected = !chosenOptions[index].props.isSelected;\n setChosenOptions(newChosen);\n } else {\n const newAvailable = [...availableOptions];\n newAvailable[index].props.isSelected = !availableOptions[index].props.isSelected;\n setAvailableOptions(newAvailable);\n }\n };\n\n return (\n <DragDropContainer\n items={allDraggableItems}\n onDrop={handleDragOperation}\n onContainerMove={handleDragOperation}\n onCancel={handleDragOperation}\n variant=\"DualListSelectorList\"\n >\n <DualListSelector>\n <DualListSelectorPane\n title=\"Available\"\n status={`${availableOptions.filter((x) => x.props.isSelected).length} of ${\n availableOptions.length\n } options selected`}\n >\n <NewDroppable\n id=\"available\"\n items={allDraggableItems.available}\n variant=\"DualListSelectorList\"\n wrapper={<DualListSelectorList />}\n />\n </DualListSelectorPane>\n <DualListSelectorControlsWrapper aria-label=\"Selector controls\">\n <DualListSelectorControl\n isDisabled={!availableOptions.some((option) => option.props.isSelected)}\n onClick={() => moveSelected(true)}\n aria-label=\"Add selected\"\n >\n <AngleRightIcon />\n </DualListSelectorControl>\n <DualListSelectorControl\n isDisabled={availableOptions.length === 0}\n onClick={() => moveAll(true)}\n aria-label=\"Add all\"\n >\n <AngleDoubleRightIcon />\n </DualListSelectorControl>\n <DualListSelectorControl\n isDisabled={chosenOptions.length === 0}\n onClick={() => moveAll(false)}\n aria-label=\"Remove all\"\n >\n <RhMicronsDoubleCaretLeftIcon />\n </DualListSelectorControl>\n <DualListSelectorControl\n onClick={() => moveSelected(false)}\n isDisabled={!chosenOptions.some((option) => option.props.isSelected)}\n aria-label=\"Remove selected\"\n >\n <AngleLeftIcon />\n </DualListSelectorControl>\n </DualListSelectorControlsWrapper>\n <DualListSelectorPane\n title=\"Chosen\"\n status={`${chosenOptions.filter((x) => x.props.isSelected).length} of ${chosenOptions.length} options selected`}\n isChosen\n >\n <NewDroppable\n id=\"chosen\"\n items={allDraggableItems.chosen}\n variant=\"DualListSelectorList\"\n wrapper={<DualListSelectorList />}\n />\n </DualListSelectorPane>\n </DualListSelector>\n </DragDropContainer>\n );\n};\n","title":"Dual list selector","lang":"ts","className":""}}>
|
|
190
|
-
|
|
191
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
192
|
-
{`To enable multiple drop zones in a `}
|
|
193
|
-
|
|
194
|
-
<code {...{"className":"ws-code "}}>
|
|
195
|
-
{`<DualListSelector>`}
|
|
196
|
-
</code>
|
|
197
|
-
{`, wrap the `}
|
|
198
|
-
|
|
199
|
-
<code {...{"className":"ws-code "}}>
|
|
200
|
-
{`<DualListSelector>`}
|
|
201
|
-
</code>
|
|
202
|
-
{` component with `}
|
|
203
|
-
|
|
204
|
-
<code {...{"className":"ws-code "}}>
|
|
205
|
-
{`<DragDropContainer>`}
|
|
206
|
-
</code>
|
|
207
|
-
{`, and then include a `}
|
|
208
|
-
|
|
209
|
-
<code {...{"className":"ws-code "}}>
|
|
210
|
-
{`<Droppable>`}
|
|
211
|
-
</code>
|
|
212
|
-
{` component within each pane. Both `}
|
|
213
|
-
|
|
214
|
-
<code {...{"className":"ws-code "}}>
|
|
215
|
-
{`<DragDropContainer>`}
|
|
216
|
-
</code>
|
|
217
|
-
{` and `}
|
|
218
|
-
|
|
219
|
-
<code {...{"className":"ws-code "}}>
|
|
220
|
-
{`<Droppable>`}
|
|
221
|
-
</code>
|
|
222
|
-
{` should define the `}
|
|
223
|
-
|
|
224
|
-
<code {...{"className":"ws-code "}}>
|
|
225
|
-
{`variant`}
|
|
226
|
-
</code>
|
|
227
|
-
{` property as "DualListSelectorList".`}
|
|
228
|
-
</p>
|
|
229
|
-
</Example>
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const Component = () => (
|
|
233
|
-
<React.Fragment>
|
|
234
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
235
|
-
{`Note: This drag and drop implementation lives in its own package at `}
|
|
236
|
-
<PatternflyThemeLink {...{"to":"https://www.npmjs.com/package/@patternfly/react-drag-drop","className":""}}>
|
|
237
|
-
{`@patternfly/react-drag-drop`}
|
|
238
|
-
</PatternflyThemeLink>
|
|
239
|
-
{`!`}
|
|
240
|
-
</p>
|
|
241
|
-
<AutoLinkHeader {...{"id":"sorting-demos","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
242
|
-
{`Sorting demos`}
|
|
243
|
-
</AutoLinkHeader>
|
|
244
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
245
|
-
{`To enable drag and drop for compatible components, wrap the component with `}
|
|
246
|
-
<code {...{"className":"ws-code "}}>
|
|
247
|
-
{`<DragDropSort>`}
|
|
248
|
-
</code>
|
|
249
|
-
{`, define the `}
|
|
250
|
-
<code {...{"className":"ws-code "}}>
|
|
251
|
-
{`variant`}
|
|
252
|
-
</code>
|
|
253
|
-
{` property, and pass both the sortable `}
|
|
254
|
-
<code {...{"className":"ws-code "}}>
|
|
255
|
-
{`items`}
|
|
256
|
-
</code>
|
|
257
|
-
{` and `}
|
|
258
|
-
<code {...{"className":"ws-code "}}>
|
|
259
|
-
{`onDrop`}
|
|
260
|
-
</code>
|
|
261
|
-
{` callback to `}
|
|
262
|
-
<code {...{"className":"ws-code "}}>
|
|
263
|
-
{`<DragDropSort>`}
|
|
264
|
-
</code>
|
|
265
|
-
{`. `}
|
|
266
|
-
<code {...{"className":"ws-code "}}>
|
|
267
|
-
{`<DragDropSort>`}
|
|
268
|
-
</code>
|
|
269
|
-
{` will create the component's usual `}
|
|
270
|
-
<code {...{"className":"ws-code "}}>
|
|
271
|
-
{`children`}
|
|
272
|
-
</code>
|
|
273
|
-
{` internally based on the `}
|
|
274
|
-
<code {...{"className":"ws-code "}}>
|
|
275
|
-
{`items`}
|
|
276
|
-
</code>
|
|
277
|
-
{` property, so `}
|
|
278
|
-
<code {...{"className":"ws-code "}}>
|
|
279
|
-
{`children`}
|
|
280
|
-
</code>
|
|
281
|
-
{` should not be passed to the wrapped component.`}
|
|
282
|
-
</p>
|
|
283
|
-
{React.createElement(pageData.examples["Drag and drop sortable data list"])}
|
|
284
|
-
{React.createElement(pageData.examples["Drag and drop sortable dual list selector"])}
|
|
285
|
-
<AutoLinkHeader {...{"id":"multiple-drop-zone-demos","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
286
|
-
{`Multiple drop zone demos`}
|
|
287
|
-
</AutoLinkHeader>
|
|
288
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
289
|
-
{`To enable multiple drop zones, wrap the component with `}
|
|
290
|
-
<code {...{"className":"ws-code "}}>
|
|
291
|
-
{`<DragDropContainer>`}
|
|
292
|
-
</code>
|
|
293
|
-
{`, place one or more `}
|
|
294
|
-
<code {...{"className":"ws-code "}}>
|
|
295
|
-
{`<Droppable>`}
|
|
296
|
-
</code>
|
|
297
|
-
{` components within the container, and define the `}
|
|
298
|
-
<code {...{"className":"ws-code "}}>
|
|
299
|
-
{`variant`}
|
|
300
|
-
</code>
|
|
301
|
-
{` property on all components. A collection of all draggable items should be passed to `}
|
|
302
|
-
<code {...{"className":"ws-code "}}>
|
|
303
|
-
{`<DragDropContainer>`}
|
|
304
|
-
</code>
|
|
305
|
-
{`, and each `}
|
|
306
|
-
<code {...{"className":"ws-code "}}>
|
|
307
|
-
{`<Droppable>`}
|
|
308
|
-
</code>
|
|
309
|
-
{` should be passed their respective draggable items.`}
|
|
310
|
-
</p>
|
|
311
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
312
|
-
<code {...{"className":"ws-code "}}>
|
|
313
|
-
{`<Droppable>`}
|
|
314
|
-
</code>
|
|
315
|
-
{` will create the component's usual `}
|
|
316
|
-
<code {...{"className":"ws-code "}}>
|
|
317
|
-
{`children`}
|
|
318
|
-
</code>
|
|
319
|
-
{` internally based on the `}
|
|
320
|
-
<code {...{"className":"ws-code "}}>
|
|
321
|
-
{`items`}
|
|
322
|
-
</code>
|
|
323
|
-
{` property, so `}
|
|
324
|
-
<code {...{"className":"ws-code "}}>
|
|
325
|
-
{`children`}
|
|
326
|
-
</code>
|
|
327
|
-
{` should not be passed where the `}
|
|
328
|
-
<code {...{"className":"ws-code "}}>
|
|
329
|
-
{`<Droppable>`}
|
|
330
|
-
</code>
|
|
331
|
-
{` is defined.`}
|
|
332
|
-
</p>
|
|
333
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
334
|
-
{`To avoid a wrapping div inserted by `}
|
|
335
|
-
<code {...{"className":"ws-code "}}>
|
|
336
|
-
{`<Droppable>`}
|
|
337
|
-
</code>
|
|
338
|
-
{`, pass the desired container element to the `}
|
|
339
|
-
<code {...{"className":"ws-code "}}>
|
|
340
|
-
{`wrapper`}
|
|
341
|
-
</code>
|
|
342
|
-
{` property.`}
|
|
343
|
-
</p>
|
|
344
|
-
{React.createElement(pageData.examples["Data list"])}
|
|
345
|
-
{React.createElement(pageData.examples["Dual list selector"])}
|
|
346
|
-
</React.Fragment>
|
|
347
|
-
);
|
|
348
|
-
Component.displayName = 'ComponentsDragAndDropReactDemosDocs';
|
|
349
|
-
Component.pageData = pageData;
|
|
350
|
-
|
|
351
|
-
export default Component;
|