@patternfly/react-docs 7.6.0-prerelease.6 → 7.6.0-prerelease.8
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 +4 -0
- package/package.json +12 -13
- package/patternfly-docs/generated/components/about-modal/react.js +149 -0
- package/patternfly-docs/generated/components/accordion/react.js +262 -0
- package/patternfly-docs/generated/components/action-list/react.js +144 -0
- package/patternfly-docs/generated/components/alert/react-demos.js +56 -0
- package/patternfly-docs/generated/components/alert/react.js +1433 -0
- package/patternfly-docs/generated/components/avatar/react.js +166 -0
- package/patternfly-docs/generated/components/back-to-top/react-demos.js +60 -0
- package/patternfly-docs/generated/components/back-to-top/react.js +77 -0
- package/patternfly-docs/generated/components/backdrop/react.js +64 -0
- package/patternfly-docs/generated/components/background-image/react.js +62 -0
- package/patternfly-docs/generated/components/badge/react.js +97 -0
- package/patternfly-docs/generated/components/banner/react-demos.js +57 -0
- package/patternfly-docs/generated/components/banner/react.js +148 -0
- package/patternfly-docs/generated/components/brand/react.js +142 -0
- package/patternfly-docs/generated/components/breadcrumb/react.js +206 -0
- package/patternfly-docs/generated/components/button/react-demos.js +57 -0
- package/patternfly-docs/generated/components/button/react.js +826 -0
- package/patternfly-docs/generated/components/card/react-demos.js +201 -0
- package/patternfly-docs/generated/components/card/react.js +1015 -0
- package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +1350 -0
- package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +1334 -0
- package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +1282 -0
- package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +848 -0
- package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +192 -0
- package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +426 -0
- package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +804 -0
- package/patternfly-docs/generated/components/charts/legends/-Victory.js +3230 -0
- package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +1178 -0
- package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +525 -0
- package/patternfly-docs/generated/components/charts/patterns/-Victory.js +3382 -0
- package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +377 -0
- package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +2475 -0
- package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +538 -0
- package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +1551 -0
- package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +4115 -0
- package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +955 -0
- package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +1173 -0
- package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +1166 -0
- package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +413 -0
- package/patternfly-docs/generated/components/chip/react-deprecated.js +323 -0
- package/patternfly-docs/generated/components/clipboard-copy/react.js +373 -0
- package/patternfly-docs/generated/components/code-block/react.js +148 -0
- package/patternfly-docs/generated/components/code-editor/react.js +659 -0
- package/patternfly-docs/generated/components/compass/react-demos.js +147 -0
- package/patternfly-docs/generated/components/compass/react.js +440 -0
- package/patternfly-docs/generated/components/content/react.js +248 -0
- package/patternfly-docs/generated/components/data-list/react-demos.js +90 -0
- package/patternfly-docs/generated/components/data-list/react.js +709 -0
- package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +283 -0
- package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +64 -0
- package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +83 -0
- package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +395 -0
- package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +241 -0
- package/patternfly-docs/generated/components/description-list/react-demos.js +58 -0
- package/patternfly-docs/generated/components/description-list/react.js +743 -0
- package/patternfly-docs/generated/components/divider/react.js +126 -0
- package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +351 -0
- package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +184 -0
- package/patternfly-docs/generated/components/drag-and-drop/react.js +137 -0
- package/patternfly-docs/generated/components/drawer/react.js +598 -0
- package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +772 -0
- package/patternfly-docs/generated/components/dual-list-selector/react.js +594 -0
- package/patternfly-docs/generated/components/empty-state/react.js +199 -0
- package/patternfly-docs/generated/components/expandable-section/react-demos.js +65 -0
- package/patternfly-docs/generated/components/expandable-section/react.js +408 -0
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +52 -0
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +398 -0
- package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +749 -0
- package/patternfly-docs/generated/components/forms/checkbox/react.js +222 -0
- package/patternfly-docs/generated/components/forms/form/react.js +1106 -0
- package/patternfly-docs/generated/components/forms/form-select/react.js +208 -0
- package/patternfly-docs/generated/components/forms/radio/react.js +212 -0
- package/patternfly-docs/generated/components/forms/text-area/react.js +160 -0
- package/patternfly-docs/generated/components/forms/text-input/react.js +216 -0
- package/patternfly-docs/generated/components/helper-text/react-demos.js +180 -0
- package/patternfly-docs/generated/components/helper-text/react.js +164 -0
- package/patternfly-docs/generated/components/hero/react.js +88 -0
- package/patternfly-docs/generated/components/hint/react.js +169 -0
- package/patternfly-docs/generated/components/icon/react.js +215 -0
- package/patternfly-docs/generated/components/input-group/react.js +182 -0
- package/patternfly-docs/generated/components/jump-links/react-demos.js +154 -0
- package/patternfly-docs/generated/components/jump-links/react.js +212 -0
- package/patternfly-docs/generated/components/label/react-demos.js +57 -0
- package/patternfly-docs/generated/components/label/react.js +417 -0
- package/patternfly-docs/generated/components/list/react.js +175 -0
- package/patternfly-docs/generated/components/login-page/react.js +587 -0
- package/patternfly-docs/generated/components/masthead/react-demos.js +79 -0
- package/patternfly-docs/generated/components/masthead/react.js +291 -0
- package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +769 -0
- package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +665 -0
- package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +187 -0
- package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +163 -0
- package/patternfly-docs/generated/components/menus/dropdown/react.js +998 -0
- package/patternfly-docs/generated/components/menus/menu/react.js +1540 -0
- package/patternfly-docs/generated/components/menus/menu-toggle/react.js +747 -0
- package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +508 -0
- package/patternfly-docs/generated/components/menus/select/react-templates.js +257 -0
- package/patternfly-docs/generated/components/menus/select/react.js +998 -0
- package/patternfly-docs/generated/components/modal/react-deprecated.js +554 -0
- package/patternfly-docs/generated/components/modal/react.js +597 -0
- package/patternfly-docs/generated/components/navigation/react-demos.js +356 -0
- package/patternfly-docs/generated/components/navigation/react.js +409 -0
- package/patternfly-docs/generated/components/notification-badge/react.js +196 -0
- package/patternfly-docs/generated/components/notification-drawer/react-demos.js +107 -0
- package/patternfly-docs/generated/components/notification-drawer/react.js +394 -0
- package/patternfly-docs/generated/components/number-input/react.js +210 -0
- package/patternfly-docs/generated/components/overflow-menu/react.js +274 -0
- package/patternfly-docs/generated/components/page/react-demos.js +149 -0
- package/patternfly-docs/generated/components/page/react.js +1352 -0
- package/patternfly-docs/generated/components/pagination/react.js +492 -0
- package/patternfly-docs/generated/components/panel/react.js +236 -0
- package/patternfly-docs/generated/components/popover/react.js +390 -0
- package/patternfly-docs/generated/components/progress/react-demos.js +59 -0
- package/patternfly-docs/generated/components/progress/react.js +283 -0
- package/patternfly-docs/generated/components/progress-stepper/react-demos.js +45 -0
- package/patternfly-docs/generated/components/progress-stepper/react.js +219 -0
- package/patternfly-docs/generated/components/search-input/react-demos.js +113 -0
- package/patternfly-docs/generated/components/search-input/react.js +263 -0
- package/patternfly-docs/generated/components/sidebar/react.js +236 -0
- package/patternfly-docs/generated/components/simple-list/react.js +200 -0
- package/patternfly-docs/generated/components/skeleton/react-demos.js +44 -0
- package/patternfly-docs/generated/components/skeleton/react.js +122 -0
- package/patternfly-docs/generated/components/skip-to-content/react.js +73 -0
- package/patternfly-docs/generated/components/slider/react.js +309 -0
- package/patternfly-docs/generated/components/spinner/react.js +111 -0
- package/patternfly-docs/generated/components/switch/react.js +163 -0
- package/patternfly-docs/generated/components/table/react-demos.js +355 -0
- package/patternfly-docs/generated/components/table/react-deprecated.js +1350 -0
- package/patternfly-docs/generated/components/table/react.js +3241 -0
- package/patternfly-docs/generated/components/tabs/react-demos.js +108 -0
- package/patternfly-docs/generated/components/tabs/react.js +1359 -0
- package/patternfly-docs/generated/components/text-input-group/react-demos.js +152 -0
- package/patternfly-docs/generated/components/text-input-group/react.js +278 -0
- package/patternfly-docs/generated/components/tile/react-deprecated.js +242 -0
- package/patternfly-docs/generated/components/timestamp/react.js +283 -0
- package/patternfly-docs/generated/components/title/react.js +94 -0
- package/patternfly-docs/generated/components/toggle-group/react.js +299 -0
- package/patternfly-docs/generated/components/toolbar/react-demos.js +66 -0
- package/patternfly-docs/generated/components/toolbar/react.js +932 -0
- package/patternfly-docs/generated/components/tooltip/react.js +241 -0
- package/patternfly-docs/generated/components/tree-view/react.js +429 -0
- package/patternfly-docs/generated/components/truncate/react.js +211 -0
- package/patternfly-docs/generated/components/wizard/react-demos.js +87 -0
- package/patternfly-docs/generated/components/wizard/react-deprecated.js +788 -0
- package/patternfly-docs/generated/components/wizard/react.js +986 -0
- package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +285 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +70 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +506 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +94 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +272 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +87 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +124 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +112 -0
- package/patternfly-docs/generated/index.js +1769 -0
- package/patternfly-docs/generated/patterns/card-view/react-demos.js +78 -0
- package/patternfly-docs/generated/patterns/filters/react-demos.js +141 -0
- package/patternfly-docs/generated/patterns/password-generator/react-demos.js +51 -0
- package/patternfly-docs/generated/patterns/password-strength/react-demos.js +61 -0
- package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +124 -0
- package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +81 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import '../../../../../react-core/src/components/Truncate/examples/./TruncateExamples.css';
|
|
4
|
+
const pageData = {
|
|
5
|
+
"id": "Truncate",
|
|
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/truncate/react",
|
|
16
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Truncate/examples/Truncate.md",
|
|
17
|
+
"relPath": "packages/react-core/src/components/Truncate/examples/Truncate.md",
|
|
18
|
+
"propComponents": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Truncate",
|
|
21
|
+
"description": "",
|
|
22
|
+
"props": [
|
|
23
|
+
{
|
|
24
|
+
"name": "className",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Class to add to outer span"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "content",
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Text to truncate",
|
|
32
|
+
"required": true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "href",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "An HREF to turn the truncate wrapper into an anchor element. For more custom control, use the\ntooltipProps with a triggerRef property passed in."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "maxCharsDisplayed",
|
|
41
|
+
"type": "number",
|
|
42
|
+
"description": "The maximum number of characters to display before truncating. This will always truncate content\nwhen its length exceeds the value passed to this prop, and container width/resizing will not affect truncation."
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "omissionContent",
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "The content to use to signify omission of characters when using the maxCharsDisplayed prop.\nBy default this will render an ellipsis."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "position",
|
|
51
|
+
"type": "'start' | 'middle' | 'end'",
|
|
52
|
+
"description": "Where the text will be truncated"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "tooltipPosition",
|
|
56
|
+
"type": "| TooltipPosition\n| 'auto'\n| 'top'\n| 'bottom'\n| 'left'\n| 'right'\n| 'top-start'\n| 'top-end'\n| 'bottom-start'\n| 'bottom-end'\n| 'left-start'\n| 'left-end'\n| 'right-start'\n| 'right-end'",
|
|
57
|
+
"description": "Tooltip position"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "tooltipProps",
|
|
61
|
+
"type": "Omit<TooltipProps, 'content'>",
|
|
62
|
+
"description": "Additional props to pass to the tooltip."
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "trailingNumChars",
|
|
66
|
+
"type": "number",
|
|
67
|
+
"description": "The number of characters displayed in the second half of a middle truncation. This will be overridden by\nthe maxCharsDisplayed prop."
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"cssPrefix": [
|
|
73
|
+
"pf-v6-c-truncate"
|
|
74
|
+
],
|
|
75
|
+
"examples": [
|
|
76
|
+
"Default",
|
|
77
|
+
"Middle",
|
|
78
|
+
"Start",
|
|
79
|
+
"With custom tooltip position",
|
|
80
|
+
"Based on max characters",
|
|
81
|
+
"With links"
|
|
82
|
+
]
|
|
83
|
+
};
|
|
84
|
+
pageData.relativeImports = "import 'react-core/src/components/Truncate/examples/./TruncateExamples.css';"
|
|
85
|
+
pageData.examples = {
|
|
86
|
+
'Default': props =>
|
|
87
|
+
<Example {...pageData} {...props} {...{"code":"import { Truncate } from '@patternfly/react-core';\n\nexport const TruncateDefault: React.FunctionComponent = () => (\n <div className=\"truncate-example-resize\">\n <Truncate content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'} />\n </div>\n);\n","title":"Default","lang":"ts","className":""}}>
|
|
88
|
+
|
|
89
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
90
|
+
{`By default content will be truncated at its end when it cannot fit entirely inside its parent container.`}
|
|
91
|
+
</p>
|
|
92
|
+
</Example>,
|
|
93
|
+
'Middle': props =>
|
|
94
|
+
<Example {...pageData} {...props} {...{"code":"import { Truncate } from '@patternfly/react-core';\n\nexport const TruncateMiddle: React.FunctionComponent = () => (\n <div className=\"truncate-example-resize\">\n <Truncate\n content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}\n trailingNumChars={10}\n position={'middle'}\n />\n </div>\n);\n","title":"Middle","lang":"ts","className":""}}>
|
|
95
|
+
|
|
96
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
97
|
+
{`When passing a `}
|
|
98
|
+
|
|
99
|
+
<code {...{"className":"ws-code "}}>
|
|
100
|
+
{`position`}
|
|
101
|
+
</code>
|
|
102
|
+
{` property with a value of "middle", the position of the truncation will change based on the parent container's width and the amount of `}
|
|
103
|
+
|
|
104
|
+
<code {...{"className":"ws-code "}}>
|
|
105
|
+
{`trailingNumChars`}
|
|
106
|
+
</code>
|
|
107
|
+
{` passed in. The `}
|
|
108
|
+
|
|
109
|
+
<code {...{"className":"ws-code "}}>
|
|
110
|
+
{`trailingNumChars`}
|
|
111
|
+
</code>
|
|
112
|
+
{` will always be displayed, while the rest of the content will be truncated based on the parent container width.`}
|
|
113
|
+
</p>
|
|
114
|
+
</Example>,
|
|
115
|
+
'Start': props =>
|
|
116
|
+
<Example {...pageData} {...props} {...{"code":"import { Truncate } from '@patternfly/react-core';\n\nexport const TruncateStart: React.FunctionComponent = () => (\n <div className=\"truncate-example-resize\">\n <Truncate content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'} position={'start'} />\n </div>\n);\n","title":"Start","lang":"ts","className":""}}>
|
|
117
|
+
|
|
118
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
119
|
+
{`You can truncate content at its start by passing the `}
|
|
120
|
+
|
|
121
|
+
<code {...{"className":"ws-code "}}>
|
|
122
|
+
{`position`}
|
|
123
|
+
</code>
|
|
124
|
+
{` property with a value of "start". This can be useful if you have several strings to truncate that have similar text at the start, but unique text at the end that you want to have visible.`}
|
|
125
|
+
</p>
|
|
126
|
+
</Example>,
|
|
127
|
+
'With custom tooltip position': props =>
|
|
128
|
+
<Example {...pageData} {...props} {...{"code":"import { Truncate } from '@patternfly/react-core';\n\nexport const TruncateCustomTooltipPosition: React.FunctionComponent = () => (\n <div className=\"truncate-example-resize\">\n <Truncate\n content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}\n tooltipPosition={'bottom'}\n />\n </div>\n);\n","title":"With custom tooltip position","lang":"ts","className":""}}>
|
|
129
|
+
|
|
130
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
131
|
+
{`You can customize the position of the `}
|
|
132
|
+
|
|
133
|
+
<code {...{"className":"ws-code "}}>
|
|
134
|
+
{`<Tooltip>`}
|
|
135
|
+
</code>
|
|
136
|
+
{` that is rendered by passing in the `}
|
|
137
|
+
|
|
138
|
+
<code {...{"className":"ws-code "}}>
|
|
139
|
+
{`tooltipPosition`}
|
|
140
|
+
</code>
|
|
141
|
+
{` property. The following example overrides the default "top" position with a "bottom" position.`}
|
|
142
|
+
</p>
|
|
143
|
+
</Example>,
|
|
144
|
+
'Based on max characters': props =>
|
|
145
|
+
<Example {...pageData} {...props} {...{"code":"import { Truncate, TruncatePosition } from '@patternfly/react-core';\n\nexport const TruncateMaxChars: React.FunctionComponent = () => (\n <>\n <div>Truncated at end position:</div>\n <Truncate\n maxCharsDisplayed={15}\n content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}\n />\n <br />\n <br />\n <div>Truncated at middle position:</div>\n <Truncate\n maxCharsDisplayed={15}\n position={TruncatePosition.middle}\n content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}\n />\n <br />\n <br />\n <div>Truncated at start position:</div>\n <Truncate\n maxCharsDisplayed={15}\n position={TruncatePosition.start}\n content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}\n />\n </>\n);\n","title":"Based on max characters","lang":"ts","className":""}}>
|
|
146
|
+
|
|
147
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
148
|
+
{`Rather than observing container width, you can have truncation be based on a maximum amount of characters that should always be displayed via the `}
|
|
149
|
+
|
|
150
|
+
<code {...{"className":"ws-code "}}>
|
|
151
|
+
{`maxCharsDisplayed`}
|
|
152
|
+
</code>
|
|
153
|
+
{` property. While the content's parent container width will not have an affect on whether truncation occurs, it will affect whether the content wraps. This property must be set to a value larger than `}
|
|
154
|
+
|
|
155
|
+
<code {...{"className":"ws-code "}}>
|
|
156
|
+
{`0`}
|
|
157
|
+
</code>
|
|
158
|
+
{`, otherwise the component will fall back to observing container width.`}
|
|
159
|
+
</p>
|
|
160
|
+
|
|
161
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
162
|
+
{`Truncating based on a maximum amount of characters will truncate the content at the end by default. When the `}
|
|
163
|
+
|
|
164
|
+
<code {...{"className":"ws-code "}}>
|
|
165
|
+
{`position`}
|
|
166
|
+
</code>
|
|
167
|
+
{` property is set to "middle", the truncation will split the content as evenly as possible, providing a more "true middle" truncation.`}
|
|
168
|
+
</p>
|
|
169
|
+
</Example>,
|
|
170
|
+
'With links': props =>
|
|
171
|
+
<Example {...pageData} {...props} {...{"code":"import { Truncate } from '@patternfly/react-core';\n\nexport const TruncateLinks: React.FunctionComponent = () => {\n const content = 'A very lengthy anchor text content to trigger truncation';\n return (\n <>\n <div>With default width-observing truncation:</div>\n <div className=\"truncate-example-resize\">\n <Truncate href=\"#\" content={content} />\n <Truncate position=\"start\" href=\"#\" content={content} />\n <Truncate position=\"middle\" href=\"#\" content={content} />\n </div>\n <br />\n <div>With max characters truncation:</div>\n <Truncate maxCharsDisplayed={15} href=\"#\" content={content} />\n <br />\n <Truncate maxCharsDisplayed={15} position=\"start\" href=\"#\" content={content} />\n <br />\n <Truncate maxCharsDisplayed={15} position=\"middle\" href=\"#\" content={content} />\n </>\n );\n};\n","title":"With links","lang":"ts","className":""}}>
|
|
172
|
+
|
|
173
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
174
|
+
{`To truncate link text, you can pass the `}
|
|
175
|
+
|
|
176
|
+
<code {...{"className":"ws-code "}}>
|
|
177
|
+
{`href`}
|
|
178
|
+
</code>
|
|
179
|
+
{` property in.`}
|
|
180
|
+
</p>
|
|
181
|
+
</Example>
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const Component = () => (
|
|
185
|
+
<React.Fragment>
|
|
186
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
187
|
+
{`Examples`}
|
|
188
|
+
</AutoLinkHeader>
|
|
189
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
190
|
+
{`The default behavior of the `}
|
|
191
|
+
<code {...{"className":"ws-code "}}>
|
|
192
|
+
{`Truncate`}
|
|
193
|
+
</code>
|
|
194
|
+
{` component is to truncate based on whether the content can fit within the width of its parent container, and to prevent text from wrapping. The following examples that use this default behavior render the `}
|
|
195
|
+
<code {...{"className":"ws-code "}}>
|
|
196
|
+
{`<Truncate>`}
|
|
197
|
+
</code>
|
|
198
|
+
{` component inside a resizable container, allowing you to see how the parent container width affects the truncation.`}
|
|
199
|
+
</p>
|
|
200
|
+
{React.createElement(pageData.examples["Default"])}
|
|
201
|
+
{React.createElement(pageData.examples["Middle"])}
|
|
202
|
+
{React.createElement(pageData.examples["Start"])}
|
|
203
|
+
{React.createElement(pageData.examples["With custom tooltip position"])}
|
|
204
|
+
{React.createElement(pageData.examples["Based on max characters"])}
|
|
205
|
+
{React.createElement(pageData.examples["With links"])}
|
|
206
|
+
</React.Fragment>
|
|
207
|
+
);
|
|
208
|
+
Component.displayName = 'ComponentsTruncateReactDocs';
|
|
209
|
+
Component.pageData = pageData;
|
|
210
|
+
|
|
211
|
+
export default Component;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { Fragment, useRef, useState } from 'react';
|
|
4
|
+
import pfLogo from '@patternfly/react-core/src/demos/assets/PF-HorizontalLogo-Color.svg';
|
|
5
|
+
import RhUiMenuBarsIcon from '@patternfly/react-icons/dist/js/icons/rh-ui-menu-bars-icon';
|
|
6
|
+
import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
|
|
7
|
+
import srcImportinmodalwithdrawerandinformationalstep from './react-demos/in-modal-with-drawer-and-informational-step.png';
|
|
8
|
+
import srcImportinmodalwithdrawer from './react-demos/in-modal-with-drawer.png';
|
|
9
|
+
import srcImportinmodal from './react-demos/in-modal.png';
|
|
10
|
+
import srcImportinpagewithdrawerandinformationalstep from './react-demos/in-page-with-drawer-and-informational-step.png';
|
|
11
|
+
import srcImportinpagewithdrawer from './react-demos/in-page-with-drawer.png';
|
|
12
|
+
import srcImportinpage from './react-demos/in-page.png';
|
|
13
|
+
const pageData = {
|
|
14
|
+
"id": "Wizard",
|
|
15
|
+
"section": "components",
|
|
16
|
+
"subsection": "",
|
|
17
|
+
"deprecated": false,
|
|
18
|
+
"template": false,
|
|
19
|
+
"beta": false,
|
|
20
|
+
"demo": false,
|
|
21
|
+
"newImplementationLink": false,
|
|
22
|
+
"source": "react-demos",
|
|
23
|
+
"tabName": null,
|
|
24
|
+
"slug": "/components/wizard/react-demos",
|
|
25
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/demos/Wizard/WizardDemo.md",
|
|
26
|
+
"relPath": "packages/react-core/src/demos/Wizard/WizardDemo.md",
|
|
27
|
+
"fullscreenExamples": [
|
|
28
|
+
"In modal",
|
|
29
|
+
"In modal, with drawer",
|
|
30
|
+
"In modal, with drawer and informational step",
|
|
31
|
+
"In page",
|
|
32
|
+
"In page, with drawer",
|
|
33
|
+
"In page, with drawer and informational step"
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
pageData.liveContext = {
|
|
37
|
+
Fragment,
|
|
38
|
+
useRef,
|
|
39
|
+
useState,
|
|
40
|
+
pfLogo,
|
|
41
|
+
RhUiMenuBarsIcon,
|
|
42
|
+
DashboardWrapper
|
|
43
|
+
};
|
|
44
|
+
pageData.examples = {
|
|
45
|
+
'In modal': props =>
|
|
46
|
+
<Example {...pageData} {...props} thumbnail={srcImportinmodal} {...{"code":"import {\n Card,\n CardBody,\n Gallery,\n GalleryItem,\n PageSection,\n Modal,\n ModalVariant,\n Wizard,\n WizardHeader,\n WizardStep\n} from '@patternfly/react-core';\nimport { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';\n\nexport const WizardInModalDemo: React.FunctionComponent = () => (\n <>\n <DashboardWrapper hasPageTemplateTitle>\n <PageSection isWidthLimited aria-label=\"Card gallery\">\n <Gallery hasGutter>\n {Array.from({ length: 10 }).map((_value, index) => (\n <GalleryItem key={index}>\n <Card>\n <CardBody>This is a card</CardBody>\n </Card>\n </GalleryItem>\n ))}\n </Gallery>\n </PageSection>\n </DashboardWrapper>\n <Modal\n isOpen\n variant={ModalVariant.large}\n showClose={false}\n hasNoBodyWrapper\n aria-describedby=\"wiz-modal-demo-description\"\n aria-labelledby=\"wiz-modal-demo-title\"\n >\n <Wizard\n header={\n <WizardHeader\n title=\"Wizard in modal\"\n titleId=\"wiz-modal-demo-title\"\n description=\"Simple wizard description\"\n descriptionId=\"wiz-modal-demo-description\"\n closeButtonAriaLabel=\"Close wizard\"\n />\n }\n >\n <WizardStep name=\"Information\" id=\"wizard-step-1\">\n <p>Step 1 content</p>\n </WizardStep>\n <WizardStep\n name=\"Configuration\"\n id=\"wizard-step-2\"\n steps={[\n <WizardStep name=\"Substep A\" id=\"wizard-step-2a\" key=\"wizard-step-2a\">\n <p>Configuration substep A</p>\n </WizardStep>,\n <WizardStep name=\"Substep B\" id=\"wizard-step-2b\" key=\"wizard-step-2b\">\n <p>Configuration substep B</p>\n </WizardStep>\n ]}\n />\n <WizardStep name=\"Additional\" id=\"wizard-step-3\">\n <p>Step 3 content</p>\n </WizardStep>\n <WizardStep name=\"Review\" id=\"wizard-step-4\" footer={{ nextButtonText: 'Finish' }}>\n <p>Review step content</p>\n </WizardStep>\n </Wizard>\n </Modal>\n </>\n);\n","title":"In modal","lang":"ts","isFullscreen":true,"className":""}}>
|
|
47
|
+
|
|
48
|
+
</Example>,
|
|
49
|
+
'In modal, with drawer': props =>
|
|
50
|
+
<Example {...pageData} {...props} thumbnail={srcImportinmodalwithdrawer} {...{"code":"import { useRef, useState } from 'react';\nimport {\n Button,\n Drawer,\n DrawerContent,\n DrawerPanelContent,\n DrawerHead,\n DrawerActions,\n DrawerCloseButton,\n Flex,\n Modal,\n ModalVariant,\n Wizard,\n WizardHeader,\n WizardStep\n} from '@patternfly/react-core';\n\nexport const WizardModalWithDrawerDemo: React.FunctionComponent = () => {\n const [isDrawerExpanded, setIsDrawerExpanded] = useState(false);\n const drawerRef = useRef<HTMLSpanElement | null>(null);\n\n const onExpand = () => {\n if (drawerRef.current) {\n drawerRef.current.focus();\n }\n };\n\n const onOpenClick = () => {\n setIsDrawerExpanded(true);\n };\n\n const onCloseClick = () => {\n setIsDrawerExpanded(false);\n };\n\n const createStepContentWithDrawer = (stepName: string) => (\n <Drawer isInline isExpanded={isDrawerExpanded} onExpand={onExpand}>\n <DrawerContent\n panelContent={\n <DrawerPanelContent widths={{ default: 'width_33' }}>\n <DrawerHead>\n <span tabIndex={isDrawerExpanded ? 0 : -1} ref={drawerRef}>\n Drawer content: {stepName}\n </span>\n <DrawerActions>\n <DrawerCloseButton onClick={onCloseClick} />\n </DrawerActions>\n </DrawerHead>\n </DrawerPanelContent>\n }\n >\n <Flex\n className=\"pf-v6-c-wizard__main-body\"\n direction={{ default: 'column' }}\n spaceItems={{ default: 'spaceItemsLg' }}\n height=\"100%\"\n >\n {!isDrawerExpanded && (\n <Button isInline variant=\"link\" onClick={onOpenClick}>\n Open drawer\n </Button>\n )}\n <div>{stepName} content</div>\n </Flex>\n </DrawerContent>\n </Drawer>\n );\n\n return (\n <Modal\n isOpen\n variant={ModalVariant.large}\n showClose={false}\n hasNoBodyWrapper\n aria-describedby=\"wiz-modal-demo-description\"\n aria-labelledby=\"wiz-modal-demo-title\"\n >\n <Wizard\n header={\n <WizardHeader\n closeButtonAriaLabel=\"Close wizard\"\n title=\"Wizard in modal with drawer\"\n titleId=\"wiz-modal-demo-title\"\n description=\"Simple wizard description\"\n descriptionId=\"wiz-modal-demo-description\"\n />\n }\n >\n <WizardStep body={{ hasNoPadding: true }} name=\"Information\" id=\"wizard-step-1\">\n {createStepContentWithDrawer('Information step')}\n </WizardStep>\n <WizardStep\n name=\"Configuration\"\n id=\"wizard-step-2\"\n steps={[\n <WizardStep body={{ hasNoPadding: true }} name=\"Substep A\" id=\"wizard-step-2a\" key=\"wizard-step-2a\">\n {createStepContentWithDrawer('Configuration substep A')}\n </WizardStep>,\n <WizardStep body={{ hasNoPadding: true }} name=\"Substep B\" id=\"wizard-step-2b\" key=\"wizard-step-2b\">\n {createStepContentWithDrawer('Configuration substep B')}\n </WizardStep>\n ]}\n />\n <WizardStep body={{ hasNoPadding: true }} name=\"Additional\" id=\"wizard-step-3\">\n {createStepContentWithDrawer('Additional step')}\n </WizardStep>\n <WizardStep\n body={{ hasNoPadding: true }}\n name=\"Review\"\n id=\"wizard-step-4\"\n footer={{ nextButtonText: 'Finish' }}\n >\n {createStepContentWithDrawer('Review step')}\n </WizardStep>\n </Wizard>\n </Modal>\n );\n};\n","title":"In modal, with drawer","lang":"ts","isFullscreen":true,"className":""}}>
|
|
51
|
+
|
|
52
|
+
</Example>,
|
|
53
|
+
'In modal, with drawer and informational step': props =>
|
|
54
|
+
<Example {...pageData} {...props} thumbnail={srcImportinmodalwithdrawerandinformationalstep} {...{"code":"import { useRef, useState } from 'react';\nimport {\n Button,\n Content,\n Drawer,\n DrawerActions,\n DrawerCloseButton,\n DrawerContent,\n DrawerPanelContent,\n DrawerHead,\n Flex,\n Modal,\n ModalVariant,\n Wizard,\n WizardHeader,\n WizardStep\n} from '@patternfly/react-core';\n\nexport const WizardModalWithDrawerInfoStepDemo: React.FunctionComponent = () => {\n const [isDrawerExpanded, setIsDrawerExpanded] = useState(false);\n const drawerRef = useRef<HTMLSpanElement | null>(null);\n\n const onExpand = () => {\n if (drawerRef.current) {\n drawerRef.current.focus();\n }\n };\n\n const onOpenClick = () => {\n setIsDrawerExpanded(true);\n };\n\n const onCloseClick = () => {\n setIsDrawerExpanded(false);\n };\n\n const createStepContentWithDrawer = (stepName: string) => (\n <Drawer isInline isExpanded={isDrawerExpanded} onExpand={onExpand}>\n <DrawerContent\n panelContent={\n <DrawerPanelContent widths={{ default: 'width_33' }}>\n <DrawerHead>\n <span tabIndex={isDrawerExpanded ? 0 : -1} ref={drawerRef}>\n Drawer content: {stepName}\n </span>\n <DrawerActions>\n <DrawerCloseButton onClick={onCloseClick} />\n </DrawerActions>\n </DrawerHead>\n </DrawerPanelContent>\n }\n >\n <Flex\n className=\"pf-v6-c-wizard__main-body\"\n direction={{ default: 'column' }}\n spaceItems={{ default: 'spaceItemsLg' }}\n height=\"100%\"\n >\n <Content>\n <h1>{stepName} content</h1>\n <p>\n Wizard description goes here. If you need more assistance,{' '}\n <Button isInline variant=\"link\" onClick={onOpenClick}>\n see more information\n </Button>{' '}\n in the side drawer.{' '}\n </p>\n </Content>\n </Flex>\n </DrawerContent>\n </Drawer>\n );\n\n return (\n <Modal\n isOpen\n variant={ModalVariant.large}\n showClose={false}\n hasNoBodyWrapper\n aria-describedby=\"wiz-modal-demo-description\"\n aria-labelledby=\"wiz-modal-demo-title\"\n >\n <Wizard\n header={\n <WizardHeader\n closeButtonAriaLabel=\"Close wizard\"\n title=\"Wizard in modal with drawer and info step\"\n titleId=\"wiz-modal-demo-title\"\n description=\"Simple wizard description\"\n descriptionId=\"wiz-modal-demo-description\"\n />\n }\n >\n <WizardStep body={{ hasNoPadding: true }} name=\"Information\" id=\"wizard-step-1\">\n {createStepContentWithDrawer('Information step')}\n </WizardStep>\n <WizardStep\n name=\"Configuration\"\n id=\"wizard-step-2\"\n steps={[\n <WizardStep body={{ hasNoPadding: true }} name=\"Substep A\" id=\"wizard-step-2a\" key=\"wizard-step-2a\">\n {createStepContentWithDrawer('Configuration substep A')}\n </WizardStep>,\n <WizardStep body={{ hasNoPadding: true }} name=\"Substep B\" id=\"wizard-step-2b\" key=\"wizard-step-2b\">\n {createStepContentWithDrawer('Configuration substep B')}\n </WizardStep>\n ]}\n />\n <WizardStep body={{ hasNoPadding: true }} name=\"Additional\" id=\"wizard-step-3\">\n {createStepContentWithDrawer('Additional step')}\n </WizardStep>\n <WizardStep\n body={{ hasNoPadding: true }}\n name=\"Review\"\n id=\"wizard-step-4\"\n footer={{ nextButtonText: 'Finish' }}\n >\n {createStepContentWithDrawer('Review step')}\n </WizardStep>\n </Wizard>\n </Modal>\n );\n};\n","title":"In modal, with drawer and informational step","lang":"ts","isFullscreen":true,"className":""}}>
|
|
55
|
+
|
|
56
|
+
</Example>,
|
|
57
|
+
'In page': props =>
|
|
58
|
+
<Example {...pageData} {...props} thumbnail={srcImportinpage} {...{"code":"import { Fragment } from 'react';\nimport { PageSection, PageSectionTypes, Wizard, WizardStep } from '@patternfly/react-core';\nimport { DashboardWrapper } from '@patternfly/react-core/src/demos/DashboardWrapper';\n\nexport const WizardFullPage: React.FunctionComponent = () => (\n <Fragment>\n <DashboardWrapper hasPageTemplateTitle>\n <PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard} aria-label=\"Wizard container\">\n <Wizard>\n <WizardStep name=\"Information\" id=\"wizard-step-1\">\n <p>Step 1 content</p>\n </WizardStep>\n <WizardStep\n name=\"Configuration\"\n id=\"wizard-step-2\"\n steps={[\n <WizardStep name=\"Substep A\" id=\"wizard-step-2a\" key=\"wizard-step-2a\">\n <p>Configuration substep A</p>\n </WizardStep>,\n <WizardStep name=\"Substep B\" id=\"wizard-step-2b\" key=\"wizard-step-2b\">\n <p>Configuration substep B</p>\n </WizardStep>\n ]}\n />\n <WizardStep name=\"Additional\" id=\"wizard-step-3\">\n <p>Step 3 content</p>\n </WizardStep>\n <WizardStep name=\"Review\" id=\"wizard-step-4\" footer={{ nextButtonText: 'Finish' }}>\n <p>Review step content</p>\n </WizardStep>\n </Wizard>\n </PageSection>\n </DashboardWrapper>\n </Fragment>\n);\n","title":"In page","lang":"ts","isFullscreen":true,"className":""}}>
|
|
59
|
+
|
|
60
|
+
</Example>,
|
|
61
|
+
'In page, with drawer': props =>
|
|
62
|
+
<Example {...pageData} {...props} thumbnail={srcImportinpagewithdrawer} {...{"code":"import { Fragment, useRef, useState } from 'react';\nimport {\n Brand,\n Breadcrumb,\n BreadcrumbItem,\n Button,\n Content,\n Drawer,\n DrawerActions,\n DrawerCloseButton,\n DrawerContent,\n DrawerPanelContent,\n DrawerHead,\n Flex,\n Nav,\n NavItem,\n NavList,\n Page,\n PageSection,\n PageSectionTypes,\n PageSidebar,\n PageSidebarBody,\n SkipToContent,\n Masthead,\n MastheadMain,\n MastheadToggle,\n MastheadBrand,\n MastheadLogo,\n PageToggleButton,\n Wizard,\n WizardStep\n} from '@patternfly/react-core';\nimport pfLogo from '@patternfly/react-core/src/demos/assets/PF-HorizontalLogo-Color.svg';\n\nexport const WizardFullPageWithDrawerDemo: React.FunctionComponent = () => {\n const [isDrawerExpanded, setIsDrawerExpanded] = useState(false);\n const [activeItem, setActiveItem] = useState(0);\n\n const drawerRef = useRef<HTMLSpanElement>(null);\n\n const onExpand = () => {\n if (drawerRef.current) {\n drawerRef.current.focus();\n }\n };\n\n const onOpenClick = () => {\n setIsDrawerExpanded(true);\n };\n\n const onCloseClick = () => {\n setIsDrawerExpanded(false);\n };\n\n const onNavSelect = (_event: React.FormEvent<HTMLElement>, result: { itemId: number | string }) => {\n setActiveItem(result.itemId as number);\n };\n\n const PageNav = (\n <Nav onSelect={onNavSelect} aria-label=\"Nav\">\n <NavList>\n <NavItem itemId={0} isActive={activeItem === 0}>\n System Panel\n </NavItem>\n <NavItem itemId={1} isActive={activeItem === 1}>\n Policy\n </NavItem>\n <NavItem itemId={2} isActive={activeItem === 2}>\n Authentication\n </NavItem>\n <NavItem itemId={3} isActive={activeItem === 3}>\n Network Services\n </NavItem>\n <NavItem itemId={4} isActive={activeItem === 4}>\n Server\n </NavItem>\n </NavList>\n </Nav>\n );\n\n const masthead = (\n <Masthead id=\"basic\">\n <MastheadMain>\n <MastheadToggle>\n <PageToggleButton isHamburgerButton aria-label=\"Global navigation\" />\n </MastheadToggle>\n <MastheadBrand>\n <MastheadLogo>\n <Brand src={pfLogo} alt=\"PatternFly\" heights={{ default: '36px' }} />\n </MastheadLogo>\n </MastheadBrand>\n </MastheadMain>\n </Masthead>\n );\n\n const Sidebar = (\n <PageSidebar>\n <PageSidebarBody>{PageNav}</PageSidebarBody>\n </PageSidebar>\n );\n\n const pageId = 'main-content-page-layout-default-nav';\n\n const handleClick = (event) => {\n event.preventDefault();\n\n const mainContentElement = document.getElementById(pageId);\n if (mainContentElement) {\n mainContentElement.focus();\n }\n };\n\n const PageSkipToContent = (\n <SkipToContent onClick={handleClick} href={`#${pageId}`}>\n Skip to content\n </SkipToContent>\n );\n\n const PageBreadcrumb = (\n <Breadcrumb>\n <BreadcrumbItem>Section home</BreadcrumbItem>\n <BreadcrumbItem to=\"#\">Section title</BreadcrumbItem>\n <BreadcrumbItem to=\"#\">Section title</BreadcrumbItem>\n <BreadcrumbItem to=\"#\" isActive>\n Section landing\n </BreadcrumbItem>\n </Breadcrumb>\n );\n\n const createStepContentWithDrawer = (stepName: string) => (\n <Drawer isInline isExpanded={isDrawerExpanded} onExpand={onExpand}>\n <DrawerContent\n panelContent={\n <DrawerPanelContent widths={{ default: 'width_33' }}>\n <DrawerHead>\n <span tabIndex={isDrawerExpanded ? 0 : -1} ref={drawerRef}>\n Drawer content: {stepName}\n </span>\n <DrawerActions>\n <DrawerCloseButton onClick={onCloseClick} />\n </DrawerActions>\n </DrawerHead>\n </DrawerPanelContent>\n }\n >\n <Flex\n className=\"pf-v6-c-wizard__main-body\"\n direction={{ default: 'column' }}\n spaceItems={{ default: 'spaceItemsLg' }}\n height=\"100%\"\n >\n {!isDrawerExpanded && (\n <Button isInline variant=\"link\" onClick={onOpenClick}>\n Open drawer\n </Button>\n )}\n <div>{stepName} content</div>\n </Flex>\n </DrawerContent>\n </Drawer>\n );\n\n return (\n <Fragment>\n <Page\n masthead={masthead}\n sidebar={Sidebar}\n isManagedSidebar\n skipToContent={PageSkipToContent}\n breadcrumb={PageBreadcrumb}\n mainContainerId={pageId}\n >\n <PageSection aria-labelledby=\"main-title\">\n <Content>\n <h1 id=\"main-title\">Main title</h1>\n <p>A demo of a wizard in a page.</p>\n </Content>\n </PageSection>\n <PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard} aria-label=\"Wizard container\">\n <Wizard>\n <WizardStep body={{ hasNoPadding: true }} name=\"Information\" id=\"wizard-step-1\">\n {createStepContentWithDrawer('Information step')}\n </WizardStep>\n <WizardStep\n name=\"Configuration\"\n id=\"wizard-step-2\"\n steps={[\n <WizardStep body={{ hasNoPadding: true }} name=\"Substep A\" id=\"wizard-step-2a\" key=\"wizard-step-2a\">\n {createStepContentWithDrawer('Configuration substep A')}\n </WizardStep>,\n <WizardStep body={{ hasNoPadding: true }} name=\"Substep B\" id=\"wizard-step-2b\" key=\"wizard-step-2b\">\n {createStepContentWithDrawer('Configuration substep B')}\n </WizardStep>\n ]}\n />\n <WizardStep body={{ hasNoPadding: true }} name=\"Additional\" id=\"wizard-step-3\">\n {createStepContentWithDrawer('Additional step')}\n </WizardStep>\n <WizardStep\n body={{ hasNoPadding: true }}\n name=\"Review\"\n id=\"wizard-step-4\"\n footer={{ nextButtonText: 'Finish' }}\n >\n {createStepContentWithDrawer('Review step')}\n </WizardStep>\n </Wizard>\n </PageSection>\n </Page>\n </Fragment>\n );\n};\n","title":"In page, with drawer","lang":"ts","isFullscreen":true,"className":""}}>
|
|
63
|
+
|
|
64
|
+
</Example>,
|
|
65
|
+
'In page, with drawer and informational step': props =>
|
|
66
|
+
<Example {...pageData} {...props} thumbnail={srcImportinpagewithdrawerandinformationalstep} {...{"code":"import { Fragment, useRef, useState } from 'react';\nimport {\n Brand,\n Breadcrumb,\n BreadcrumbItem,\n Button,\n Content,\n Drawer,\n DrawerActions,\n DrawerCloseButton,\n DrawerContent,\n DrawerHead,\n DrawerPanelContent,\n Flex,\n Nav,\n NavItem,\n NavList,\n Page,\n PageSection,\n PageSectionTypes,\n PageSidebar,\n PageSidebarBody,\n SkipToContent,\n Masthead,\n MastheadMain,\n MastheadToggle,\n MastheadBrand,\n MastheadLogo,\n PageToggleButton,\n Wizard,\n WizardStep\n} from '@patternfly/react-core';\nimport pfLogo from '@patternfly/react-core/src/demos/assets/PF-HorizontalLogo-Color.svg';\n\nexport const WizardFullPageWithDrawerInfoStepDemo: React.FunctionComponent = () => {\n const [isDrawerExpanded, setIsDrawerExpanded] = useState(false);\n const [activeItem, setActiveItem] = useState(0);\n\n const drawerRef = useRef<HTMLSpanElement | null>(null);\n\n const onExpand = () => {\n if (drawerRef.current) {\n drawerRef.current.focus();\n }\n };\n\n const onOpenClick = () => {\n setIsDrawerExpanded(true);\n };\n\n const onCloseClick = () => {\n setIsDrawerExpanded(false);\n };\n\n const onNavSelect = (_event: any, result: any) => {\n setActiveItem(result.itemId);\n };\n\n const PageNav = (\n <Nav onSelect={onNavSelect} aria-label=\"Nav\">\n <NavList>\n <NavItem itemId={0} isActive={activeItem === 0}>\n System Panel\n </NavItem>\n <NavItem itemId={1} isActive={activeItem === 1}>\n Policy\n </NavItem>\n <NavItem itemId={2} isActive={activeItem === 2}>\n Authentication\n </NavItem>\n <NavItem itemId={3} isActive={activeItem === 3}>\n Network Services\n </NavItem>\n <NavItem itemId={4} isActive={activeItem === 4}>\n Server\n </NavItem>\n </NavList>\n </Nav>\n );\n\n const masthead = (\n <Masthead id=\"basic\">\n <MastheadMain>\n <MastheadToggle>\n <PageToggleButton isHamburgerButton aria-label=\"Global navigation\" />\n </MastheadToggle>\n <MastheadBrand>\n <MastheadLogo>\n <Brand src={pfLogo} alt=\"PatternFly\" heights={{ default: '36px' }} />\n </MastheadLogo>\n </MastheadBrand>\n </MastheadMain>\n </Masthead>\n );\n\n const Sidebar = (\n <PageSidebar>\n <PageSidebarBody>{PageNav}</PageSidebarBody>\n </PageSidebar>\n );\n\n const pageId = 'main-content-page-layout-default-nav';\n\n const handleClick = (event) => {\n event.preventDefault();\n\n const mainContentElement = document.getElementById(pageId);\n if (mainContentElement) {\n mainContentElement.focus();\n }\n };\n\n const PageSkipToContent = (\n <SkipToContent onClick={handleClick} href={`#${pageId}`}>\n Skip to content\n </SkipToContent>\n );\n\n const PageBreadcrumb = (\n <Breadcrumb>\n <BreadcrumbItem>Section home</BreadcrumbItem>\n <BreadcrumbItem to=\"#\">Section title</BreadcrumbItem>\n <BreadcrumbItem to=\"#\">Section title</BreadcrumbItem>\n <BreadcrumbItem to=\"#\" isActive>\n Section landing\n </BreadcrumbItem>\n </Breadcrumb>\n );\n\n const createStepContentWithDrawer = (stepName: string) => (\n <Drawer isInline isExpanded={isDrawerExpanded} onExpand={onExpand}>\n <DrawerContent\n panelContent={\n <DrawerPanelContent widths={{ default: 'width_33' }}>\n <DrawerHead>\n <span tabIndex={isDrawerExpanded ? 0 : -1} ref={drawerRef}>\n Drawer content: {stepName}\n </span>\n <DrawerActions>\n <DrawerCloseButton onClick={onCloseClick} />\n </DrawerActions>\n </DrawerHead>\n </DrawerPanelContent>\n }\n >\n <Flex\n className=\"pf-v6-c-wizard__main-body\"\n direction={{ default: 'column' }}\n spaceItems={{ default: 'spaceItemsLg' }}\n height=\"100%\"\n >\n <Content>\n <p>{stepName} content</p>\n <p>\n Wizard description goes here. If you need more assistance,{' '}\n <Button isInline variant=\"link\" onClick={onOpenClick}>\n see more information\n </Button>{' '}\n in the side drawer.{' '}\n </p>\n </Content>\n </Flex>\n </DrawerContent>\n </Drawer>\n );\n\n return (\n <Fragment>\n <Page\n masthead={masthead}\n sidebar={Sidebar}\n isManagedSidebar\n skipToContent={PageSkipToContent}\n breadcrumb={PageBreadcrumb}\n mainContainerId={pageId}\n >\n <PageSection aria-labelledby=\"main-title\">\n <Content>\n <h1 id=\"main-title\">Main title</h1>\n <p>A demo of a wizard in a page.</p>\n </Content>\n </PageSection>\n <PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard} ß aria-label=\"Wizard container\">\n <Wizard>\n <WizardStep body={{ hasNoPadding: true }} name=\"Information\" id=\"wizard-step-1\">\n {createStepContentWithDrawer('Information step')}\n </WizardStep>\n <WizardStep\n name=\"Configuration\"\n id=\"wizard-step-2\"\n steps={[\n <WizardStep body={{ hasNoPadding: true }} name=\"Substep A\" id=\"wizard-step-2a\" key=\"wizard-step-2a\">\n {createStepContentWithDrawer('Configuration substep A')}\n </WizardStep>,\n <WizardStep body={{ hasNoPadding: true }} name=\"Substep B\" id=\"wizard-step-2b\" key=\"wizard-step-2b\">\n {createStepContentWithDrawer('Configuration substep B')}\n </WizardStep>\n ]}\n />\n <WizardStep body={{ hasNoPadding: true }} name=\"Additional\" id=\"wizard-step-3\">\n {createStepContentWithDrawer('Additional step')}\n </WizardStep>\n <WizardStep\n body={{ hasNoPadding: true }}\n name=\"Review\"\n id=\"wizard-step-4\"\n footer={{ nextButtonText: 'Finish' }}\n >\n {createStepContentWithDrawer('Review step')}\n </WizardStep>\n </Wizard>\n </PageSection>\n </Page>\n </Fragment>\n );\n};\n","title":"In page, with drawer and informational step","lang":"ts","isFullscreen":true,"className":""}}>
|
|
67
|
+
|
|
68
|
+
</Example>
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const Component = () => (
|
|
72
|
+
<React.Fragment>
|
|
73
|
+
<AutoLinkHeader {...{"id":"demos","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
74
|
+
{`Demos`}
|
|
75
|
+
</AutoLinkHeader>
|
|
76
|
+
{React.createElement(pageData.examples["In modal"])}
|
|
77
|
+
{React.createElement(pageData.examples["In modal, with drawer"])}
|
|
78
|
+
{React.createElement(pageData.examples["In modal, with drawer and informational step"])}
|
|
79
|
+
{React.createElement(pageData.examples["In page"])}
|
|
80
|
+
{React.createElement(pageData.examples["In page, with drawer"])}
|
|
81
|
+
{React.createElement(pageData.examples["In page, with drawer and informational step"])}
|
|
82
|
+
</React.Fragment>
|
|
83
|
+
);
|
|
84
|
+
Component.displayName = 'ComponentsWizardReactDemosDocs';
|
|
85
|
+
Component.pageData = pageData;
|
|
86
|
+
|
|
87
|
+
export default Component;
|