@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.
Files changed (163) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +21 -0
  3. package/package.json +12 -11
  4. package/patternfly-docs/generated/components/about-modal/react.js +0 -149
  5. package/patternfly-docs/generated/components/accordion/react.js +0 -262
  6. package/patternfly-docs/generated/components/action-list/react.js +0 -144
  7. package/patternfly-docs/generated/components/alert/react-demos.js +0 -56
  8. package/patternfly-docs/generated/components/alert/react.js +0 -1433
  9. package/patternfly-docs/generated/components/avatar/react.js +0 -166
  10. package/patternfly-docs/generated/components/back-to-top/react-demos.js +0 -60
  11. package/patternfly-docs/generated/components/back-to-top/react.js +0 -77
  12. package/patternfly-docs/generated/components/backdrop/react.js +0 -64
  13. package/patternfly-docs/generated/components/background-image/react.js +0 -62
  14. package/patternfly-docs/generated/components/badge/react.js +0 -97
  15. package/patternfly-docs/generated/components/banner/react-demos.js +0 -57
  16. package/patternfly-docs/generated/components/banner/react.js +0 -148
  17. package/patternfly-docs/generated/components/brand/react.js +0 -142
  18. package/patternfly-docs/generated/components/breadcrumb/react.js +0 -206
  19. package/patternfly-docs/generated/components/button/react-demos.js +0 -57
  20. package/patternfly-docs/generated/components/button/react.js +0 -826
  21. package/patternfly-docs/generated/components/card/react-demos.js +0 -201
  22. package/patternfly-docs/generated/components/card/react.js +0 -1015
  23. package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +0 -1350
  24. package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +0 -1334
  25. package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +0 -1282
  26. package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +0 -848
  27. package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +0 -192
  28. package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +0 -426
  29. package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +0 -804
  30. package/patternfly-docs/generated/components/charts/legends/-Victory.js +0 -3230
  31. package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +0 -1178
  32. package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +0 -525
  33. package/patternfly-docs/generated/components/charts/patterns/-Victory.js +0 -3382
  34. package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +0 -377
  35. package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +0 -2475
  36. package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +0 -538
  37. package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +0 -1551
  38. package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +0 -4115
  39. package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +0 -955
  40. package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +0 -1173
  41. package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +0 -1166
  42. package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +0 -413
  43. package/patternfly-docs/generated/components/chip/react-deprecated.js +0 -323
  44. package/patternfly-docs/generated/components/clipboard-copy/react.js +0 -373
  45. package/patternfly-docs/generated/components/code-block/react.js +0 -148
  46. package/patternfly-docs/generated/components/code-editor/react.js +0 -659
  47. package/patternfly-docs/generated/components/compass/react-demos.js +0 -147
  48. package/patternfly-docs/generated/components/compass/react.js +0 -440
  49. package/patternfly-docs/generated/components/content/react.js +0 -248
  50. package/patternfly-docs/generated/components/data-list/react-demos.js +0 -90
  51. package/patternfly-docs/generated/components/data-list/react.js +0 -709
  52. package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +0 -283
  53. package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +0 -64
  54. package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +0 -83
  55. package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +0 -395
  56. package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +0 -241
  57. package/patternfly-docs/generated/components/description-list/react-demos.js +0 -58
  58. package/patternfly-docs/generated/components/description-list/react.js +0 -743
  59. package/patternfly-docs/generated/components/divider/react.js +0 -126
  60. package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +0 -351
  61. package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +0 -184
  62. package/patternfly-docs/generated/components/drag-and-drop/react.js +0 -137
  63. package/patternfly-docs/generated/components/drawer/react.js +0 -598
  64. package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +0 -772
  65. package/patternfly-docs/generated/components/dual-list-selector/react.js +0 -594
  66. package/patternfly-docs/generated/components/empty-state/react.js +0 -199
  67. package/patternfly-docs/generated/components/expandable-section/react-demos.js +0 -65
  68. package/patternfly-docs/generated/components/expandable-section/react.js +0 -408
  69. package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +0 -52
  70. package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +0 -398
  71. package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +0 -749
  72. package/patternfly-docs/generated/components/forms/checkbox/react.js +0 -222
  73. package/patternfly-docs/generated/components/forms/form/react.js +0 -1106
  74. package/patternfly-docs/generated/components/forms/form-select/react.js +0 -208
  75. package/patternfly-docs/generated/components/forms/radio/react.js +0 -212
  76. package/patternfly-docs/generated/components/forms/text-area/react.js +0 -160
  77. package/patternfly-docs/generated/components/forms/text-input/react.js +0 -216
  78. package/patternfly-docs/generated/components/helper-text/react-demos.js +0 -180
  79. package/patternfly-docs/generated/components/helper-text/react.js +0 -164
  80. package/patternfly-docs/generated/components/hero/react.js +0 -88
  81. package/patternfly-docs/generated/components/hint/react.js +0 -169
  82. package/patternfly-docs/generated/components/icon/react.js +0 -215
  83. package/patternfly-docs/generated/components/input-group/react.js +0 -182
  84. package/patternfly-docs/generated/components/jump-links/react-demos.js +0 -154
  85. package/patternfly-docs/generated/components/jump-links/react.js +0 -212
  86. package/patternfly-docs/generated/components/label/react-demos.js +0 -57
  87. package/patternfly-docs/generated/components/label/react.js +0 -417
  88. package/patternfly-docs/generated/components/list/react.js +0 -175
  89. package/patternfly-docs/generated/components/login-page/react.js +0 -587
  90. package/patternfly-docs/generated/components/masthead/react-demos.js +0 -79
  91. package/patternfly-docs/generated/components/masthead/react.js +0 -291
  92. package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +0 -769
  93. package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +0 -665
  94. package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +0 -187
  95. package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +0 -163
  96. package/patternfly-docs/generated/components/menus/dropdown/react.js +0 -998
  97. package/patternfly-docs/generated/components/menus/menu/react.js +0 -1540
  98. package/patternfly-docs/generated/components/menus/menu-toggle/react.js +0 -747
  99. package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +0 -508
  100. package/patternfly-docs/generated/components/menus/select/react-templates.js +0 -257
  101. package/patternfly-docs/generated/components/menus/select/react.js +0 -998
  102. package/patternfly-docs/generated/components/modal/react-deprecated.js +0 -554
  103. package/patternfly-docs/generated/components/modal/react.js +0 -597
  104. package/patternfly-docs/generated/components/navigation/react-demos.js +0 -356
  105. package/patternfly-docs/generated/components/navigation/react.js +0 -409
  106. package/patternfly-docs/generated/components/notification-badge/react.js +0 -196
  107. package/patternfly-docs/generated/components/notification-drawer/react-demos.js +0 -107
  108. package/patternfly-docs/generated/components/notification-drawer/react.js +0 -394
  109. package/patternfly-docs/generated/components/number-input/react.js +0 -210
  110. package/patternfly-docs/generated/components/overflow-menu/react.js +0 -274
  111. package/patternfly-docs/generated/components/page/react-demos.js +0 -149
  112. package/patternfly-docs/generated/components/page/react.js +0 -1352
  113. package/patternfly-docs/generated/components/pagination/react.js +0 -492
  114. package/patternfly-docs/generated/components/panel/react.js +0 -236
  115. package/patternfly-docs/generated/components/popover/react.js +0 -390
  116. package/patternfly-docs/generated/components/progress/react-demos.js +0 -59
  117. package/patternfly-docs/generated/components/progress/react.js +0 -283
  118. package/patternfly-docs/generated/components/progress-stepper/react-demos.js +0 -45
  119. package/patternfly-docs/generated/components/progress-stepper/react.js +0 -219
  120. package/patternfly-docs/generated/components/search-input/react-demos.js +0 -113
  121. package/patternfly-docs/generated/components/search-input/react.js +0 -263
  122. package/patternfly-docs/generated/components/sidebar/react.js +0 -236
  123. package/patternfly-docs/generated/components/simple-list/react.js +0 -200
  124. package/patternfly-docs/generated/components/skeleton/react-demos.js +0 -44
  125. package/patternfly-docs/generated/components/skeleton/react.js +0 -122
  126. package/patternfly-docs/generated/components/skip-to-content/react.js +0 -73
  127. package/patternfly-docs/generated/components/slider/react.js +0 -309
  128. package/patternfly-docs/generated/components/spinner/react.js +0 -111
  129. package/patternfly-docs/generated/components/switch/react.js +0 -163
  130. package/patternfly-docs/generated/components/table/react-demos.js +0 -355
  131. package/patternfly-docs/generated/components/table/react-deprecated.js +0 -1350
  132. package/patternfly-docs/generated/components/table/react.js +0 -3241
  133. package/patternfly-docs/generated/components/tabs/react-demos.js +0 -108
  134. package/patternfly-docs/generated/components/tabs/react.js +0 -1359
  135. package/patternfly-docs/generated/components/text-input-group/react-demos.js +0 -152
  136. package/patternfly-docs/generated/components/text-input-group/react.js +0 -278
  137. package/patternfly-docs/generated/components/tile/react-deprecated.js +0 -242
  138. package/patternfly-docs/generated/components/timestamp/react.js +0 -283
  139. package/patternfly-docs/generated/components/title/react.js +0 -94
  140. package/patternfly-docs/generated/components/toggle-group/react.js +0 -299
  141. package/patternfly-docs/generated/components/toolbar/react-demos.js +0 -66
  142. package/patternfly-docs/generated/components/toolbar/react.js +0 -932
  143. package/patternfly-docs/generated/components/tooltip/react.js +0 -241
  144. package/patternfly-docs/generated/components/tree-view/react.js +0 -429
  145. package/patternfly-docs/generated/components/truncate/react.js +0 -211
  146. package/patternfly-docs/generated/components/wizard/react-demos.js +0 -87
  147. package/patternfly-docs/generated/components/wizard/react-deprecated.js +0 -788
  148. package/patternfly-docs/generated/components/wizard/react.js +0 -986
  149. package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +0 -285
  150. package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +0 -70
  151. package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +0 -506
  152. package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +0 -94
  153. package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +0 -272
  154. package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +0 -87
  155. package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +0 -124
  156. package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +0 -112
  157. package/patternfly-docs/generated/index.js +0 -1769
  158. package/patternfly-docs/generated/patterns/card-view/react-demos.js +0 -78
  159. package/patternfly-docs/generated/patterns/filters/react-demos.js +0 -141
  160. package/patternfly-docs/generated/patterns/password-generator/react-demos.js +0 -51
  161. package/patternfly-docs/generated/patterns/password-strength/react-demos.js +0 -61
  162. package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +0 -124
  163. package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +0 -81
@@ -1,429 +0,0 @@
1
- import React from 'react';
2
- import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
3
- import { Fragment, useEffect, useState } from 'react';
4
- import { FolderIcon, FolderOpenIcon, RhUiEllipsisVerticalFillIcon, HamburgerIcon, GitlabIcon, GithubIcon, GoogleIcon, RhUiClipboardFillIcon, RhUiStorageFillIcon } from '@patternfly/react-icons';
5
- const pageData = {
6
- "id": "Tree view",
7
- "section": "components",
8
- "subsection": "",
9
- "deprecated": false,
10
- "template": false,
11
- "beta": false,
12
- "demo": false,
13
- "newImplementationLink": false,
14
- "source": "react",
15
- "tabName": null,
16
- "slug": "/components/tree-view/react",
17
- "sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/TreeView/examples/TreeView.md",
18
- "relPath": "packages/react-core/src/components/TreeView/examples/TreeView.md",
19
- "propComponents": [
20
- {
21
- "name": "TreeView",
22
- "description": "The main tree view component.",
23
- "props": [
24
- {
25
- "name": "activeItems",
26
- "type": "TreeViewDataItem[]",
27
- "description": "Active items of tree view."
28
- },
29
- {
30
- "name": "allExpanded",
31
- "type": "boolean",
32
- "description": "Sets the expanded state on all tree nodes, overriding default behavior and current\ninternal state."
33
- },
34
- {
35
- "name": "aria-label",
36
- "type": "string",
37
- "description": "A text string that sets the accessible name of the tree view list. Either this or the aria-labelledby property must\nbe passed in."
38
- },
39
- {
40
- "name": "aria-labelledby",
41
- "type": "string",
42
- "description": "A space separated list of element id's that sets the accessible name of the tree view list. Either\nthis or the aria-label property must be passed in."
43
- },
44
- {
45
- "name": "className",
46
- "type": "string",
47
- "description": "Class to add if not passed a parentItem property."
48
- },
49
- {
50
- "name": "compareItems",
51
- "type": "(item: TreeViewDataItem, itemToCheck: TreeViewDataItem) => boolean",
52
- "description": "Comparison function for determining active items.",
53
- "defaultValue": "(item, itemToCheck) => item.id === itemToCheck.id"
54
- },
55
- {
56
- "name": "data",
57
- "type": "TreeViewDataItem[]",
58
- "description": "Data of the tree view.",
59
- "required": true
60
- },
61
- {
62
- "name": "defaultAllExpanded",
63
- "type": "boolean",
64
- "description": "Sets the default expanded behavior.",
65
- "defaultValue": "false"
66
- },
67
- {
68
- "name": "expandedIcon",
69
- "type": "React.ReactNode",
70
- "description": "Icon for all expanded node items."
71
- },
72
- {
73
- "name": "hasAnimations",
74
- "type": "boolean",
75
- "description": "Flag indicating whether a tree view has animations. This will always render\nnested tree view items rather than dynamically rendering them. This prop will be removed in\nthe next breaking change release in favor of defaulting to always-rendered items."
76
- },
77
- {
78
- "name": "hasBadges",
79
- "type": "boolean",
80
- "description": "Flag indicating if all nodes in the tree view should have badges.",
81
- "defaultValue": "false"
82
- },
83
- {
84
- "name": "hasCheckboxes",
85
- "type": "boolean",
86
- "description": "Flag indicating if all nodes in the tree view should have checkboxes.",
87
- "defaultValue": "false"
88
- },
89
- {
90
- "name": "hasGuides",
91
- "type": "boolean",
92
- "description": "Flag indicating if the tree view has guide lines.",
93
- "defaultValue": "false"
94
- },
95
- {
96
- "name": "hasSelectableNodes",
97
- "type": "boolean",
98
- "description": "Flag indicating that tree nodes should be independently selectable, even when having\nchildren.",
99
- "defaultValue": "false"
100
- },
101
- {
102
- "name": "icon",
103
- "type": "React.ReactNode",
104
- "description": "Icon for all leaf or unexpanded node items."
105
- },
106
- {
107
- "name": "id",
108
- "type": "string",
109
- "description": "ID of the tree view."
110
- },
111
- {
112
- "name": "isMultiSelectable",
113
- "type": "boolean",
114
- "description": "Flag indicating whether multiple nodes can be selected in the tree view. This will also set the\naria-multiselectable attribute on the tree view list which is required to be true when multiple selection is intended.\nCan only be applied to the root tree view list.",
115
- "defaultValue": "false"
116
- },
117
- {
118
- "name": "isNested",
119
- "type": "boolean",
120
- "description": "Flag indicating if the tree view is nested.",
121
- "defaultValue": "false"
122
- },
123
- {
124
- "name": "onCheck",
125
- "type": "(event: React.ChangeEvent<HTMLInputElement>, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void",
126
- "description": "Callback for item checkbox selection."
127
- },
128
- {
129
- "name": "onCollapse",
130
- "type": "(event: React.MouseEvent, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void",
131
- "description": "Callback for collapsing a node with children."
132
- },
133
- {
134
- "name": "onExpand",
135
- "type": "(event: React.MouseEvent, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void",
136
- "description": "Callback for expanding a node with children."
137
- },
138
- {
139
- "name": "onSelect",
140
- "type": "(event: React.MouseEvent, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void",
141
- "description": "Callback for item selection."
142
- },
143
- {
144
- "name": "parentItem",
145
- "type": "TreeViewDataItem",
146
- "description": "Internal. Parent item of a tree view list item."
147
- },
148
- {
149
- "name": "toolbar",
150
- "type": "React.ReactNode",
151
- "description": "Toolbar to display above the tree view."
152
- },
153
- {
154
- "name": "useMemo",
155
- "type": "boolean",
156
- "description": "Flag indicating the tree view should utilize memoization to help render large data sets.\nSetting this property requires that the activeItems property is passed an array containing\nevery node in the selected item's path."
157
- },
158
- {
159
- "name": "variant",
160
- "type": "'default' | 'compact' | 'compactNoBackground'",
161
- "description": "Variant presentation styles for the tree view.",
162
- "defaultValue": "'default'"
163
- }
164
- ]
165
- },
166
- {
167
- "name": "TreeViewDataItem",
168
- "description": "Properties that make up a tree view data item. These properties should be passed in as an\nobject to one of the various tree view component properties which accept TreeViewDataItem as\na type.",
169
- "props": [
170
- {
171
- "name": "action",
172
- "type": "React.ReactNode",
173
- "description": "Action of a tree view item, which can be either a button or dropdown component."
174
- },
175
- {
176
- "name": "badgeProps",
177
- "type": "any",
178
- "description": "Additional properties of the tree view item badge."
179
- },
180
- {
181
- "name": "checkProps",
182
- "type": "TreeViewCheckProps",
183
- "description": "Additional properties of the tree view item checkbox."
184
- },
185
- {
186
- "name": "children",
187
- "type": "TreeViewDataItem[]",
188
- "description": "Child nodes of a tree view item."
189
- },
190
- {
191
- "name": "customBadgeContent",
192
- "type": "React.ReactNode",
193
- "description": "Optional prop for a custom badge."
194
- },
195
- {
196
- "name": "defaultExpanded",
197
- "type": "boolean",
198
- "description": "Flag indicating if node is expanded by default."
199
- },
200
- {
201
- "name": "expandedIcon",
202
- "type": "React.ReactNode",
203
- "description": "Expanded icon of a tree view item."
204
- },
205
- {
206
- "name": "hasBadge",
207
- "type": "boolean",
208
- "description": "Flag indicating if a tree view item has a badge."
209
- },
210
- {
211
- "name": "hasCheckbox",
212
- "type": "boolean",
213
- "description": "Flag indicating if a tree view item has a checkbox."
214
- },
215
- {
216
- "name": "icon",
217
- "type": "React.ReactNode",
218
- "description": "Default icon of a tree view item."
219
- },
220
- {
221
- "name": "id",
222
- "type": "string",
223
- "description": "ID of a tree view item."
224
- },
225
- {
226
- "name": "isDisabled",
227
- "type": "boolean",
228
- "description": "Flag indicating if the tree view item is disabled."
229
- },
230
- {
231
- "name": "isToggleDisabled",
232
- "type": "boolean",
233
- "description": "Flag indicating if the tree view item toggle is disabled."
234
- },
235
- {
236
- "name": "name",
237
- "type": "React.ReactNode",
238
- "description": "Internal content of a tree view item.",
239
- "required": true
240
- },
241
- {
242
- "name": "title",
243
- "type": "React.ReactNode",
244
- "description": "Title of a tree view item. Only used in compact presentations."
245
- }
246
- ]
247
- },
248
- {
249
- "name": "TreeViewSearch",
250
- "description": "Renders a search input for the tree view. This sub-component should be passed into the\ntree view component's toolbar property.",
251
- "props": [
252
- {
253
- "name": "aria-label",
254
- "type": "string",
255
- "description": "Accessible label for the search input."
256
- },
257
- {
258
- "name": "className",
259
- "type": "string",
260
- "description": "Classes applied to the wrapper for the search input."
261
- },
262
- {
263
- "name": "id",
264
- "type": "string",
265
- "description": "Id for the search input."
266
- },
267
- {
268
- "name": "name",
269
- "type": "string",
270
- "description": "Name for the search input."
271
- },
272
- {
273
- "name": "onSearch",
274
- "type": "(event: React.ChangeEvent<HTMLInputElement>) => void",
275
- "description": "Callback for search input."
276
- }
277
- ]
278
- }
279
- ],
280
- "cssPrefix": [
281
- "pf-v6-c-tree-view"
282
- ],
283
- "examples": [
284
- "Single selectable",
285
- "Multiselectable",
286
- "With separate selection and expansion",
287
- "With search",
288
- "With checkboxes",
289
- "With icons",
290
- "With unique icon per item",
291
- "With badges",
292
- "With custom badges",
293
- "With action items",
294
- "Guides",
295
- "Compact",
296
- "Compact, no background",
297
- "With memoization"
298
- ]
299
- };
300
- pageData.liveContext = {
301
- Fragment,
302
- useEffect,
303
- useState,
304
- FolderIcon,
305
- FolderOpenIcon,
306
- RhUiEllipsisVerticalFillIcon,
307
- HamburgerIcon,
308
- GitlabIcon,
309
- GithubIcon,
310
- GoogleIcon,
311
- RhUiClipboardFillIcon,
312
- RhUiStorageFillIcon
313
- };
314
- pageData.examples = {
315
- 'Single selectable': props =>
316
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { TreeView, Button, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewSingleSelectable: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n const [allExpanded, setAllExpanded] = useState<boolean>();\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n // Ignore folders for selection\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems([treeViewItem]);\n }\n };\n\n const onToggle = (_event: React.MouseEvent) => {\n setAllExpanded((prevAllExpanded) => !prevAllExpanded);\n };\n\n const options = [\n {\n name: 'Application launcher',\n id: 'example1-AppLaunch',\n children: [\n {\n name: 'Application 1',\n id: 'example1-App1',\n children: [\n { name: 'Settings', id: 'example1-App1Settings' },\n { name: 'Current', id: 'example1-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'example1-App2',\n children: [\n { name: 'Settings', id: 'example1-App2Settings' },\n {\n name: 'Loader',\n id: 'example1-App2Loader',\n children: [\n { name: 'Loading App 1', id: 'example1-LoadApp1' },\n { name: 'Loading App 2', id: 'example1-LoadApp2' },\n { name: 'Loading App 3', id: 'example1-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'example1-Cost',\n children: [\n {\n name: 'Application 3',\n id: 'example1-App3',\n children: [\n { name: 'Settings', id: 'example1-App3Settings' },\n { name: 'Current', id: 'example1-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'example1-Sources',\n children: [\n { name: 'Application 4', id: 'example1-App4', children: [{ name: 'Settings', id: 'example1-App4Settings' }] }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'example1-Long',\n children: [{ name: 'Application 5', id: 'example1-App5' }]\n }\n ];\n return (\n <Fragment>\n <Button variant=\"link\" onClick={onToggle}>\n {allExpanded && 'Collapse all'}\n {!allExpanded && 'Expand all'}\n </Button>\n <TreeView\n hasAnimations\n aria-label=\"Tree View single selectable example\"\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n allExpanded={allExpanded}\n />\n </Fragment>\n );\n};\n","title":"Single selectable","lang":"ts","className":""}}>
317
-
318
- </Example>,
319
- 'Multiselectable': props =>
320
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TreeView, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewMultiselectable: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>([]);\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n // Ignore folders for selection\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems((prevActiveItems) => [...prevActiveItems, treeViewItem]);\n }\n };\n\n const options = [\n {\n name: 'Application launcher',\n id: 'multiselectExample-AppLaunch',\n children: [\n {\n name: 'Application 1',\n id: 'multiselectExample-App1',\n children: [\n { name: 'Settings', id: 'multiselectExample-App1Settings' },\n { name: 'Current', id: 'multiselectExample-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'multiselectExample-App2',\n children: [\n { name: 'Settings', id: 'multiselectExample-App2Settings' },\n {\n name: 'Loader',\n id: 'multiselectExample-App2Loader',\n children: [\n { name: 'Loading App 1', id: 'multiselectExample-LoadApp1' },\n { name: 'Loading App 2', id: 'multiselectExample-LoadApp2' },\n { name: 'Loading App 3', id: 'multiselectExample-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'multiselectExample-Cost',\n children: [\n {\n name: 'Application 3',\n id: 'multiselectExample-App3',\n children: [\n { name: 'Settings', id: 'multiselectExample-App3Settings' },\n { name: 'Current', id: 'multiselectExample-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'multiselectExample-Sources',\n children: [\n {\n name: 'Application 4',\n id: 'multiselectExample-App4',\n children: [{ name: 'Settings', id: 'multiselectExample-App4Settings' }]\n }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'multiselectExample-Long',\n children: [{ name: 'Application 5', id: 'multiselectExample-App5' }]\n }\n ];\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View multiselectable example\"\n isMultiSelectable\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n />\n );\n};\n","title":"Multiselectable","lang":"ts","className":""}}>
321
-
322
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
323
- {`A tree view can be setup to allow multiple nodes to be selected. When a tree view is intended to allow multiple selection, the `}
324
-
325
- <code {...{"className":"ws-code "}}>
326
- {`isMultiSelectable`}
327
- </code>
328
- {` property must be passed.`}
329
- </p>
330
- </Example>,
331
- 'With separate selection and expansion': props =>
332
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TreeView, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewSelectableNodes: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n setActiveItems([treeViewItem]);\n };\n\n const options = [\n {\n name: 'Application launcher',\n id: 'SelNodesTreeView-AppLaunch',\n children: [\n {\n name: 'Application 1',\n id: 'SelNodesTreeView-App1',\n children: [\n { name: 'Settings', id: 'SelNodesTreeView-App1Settings' },\n { name: 'Current', id: 'SelNodesTreeView-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'SelNodesTreeView-App2',\n children: [\n { name: 'Settings', id: 'SelNodesTreeView-App2Settings' },\n {\n name: 'Loader',\n id: 'SelNodesTreeView-App2Loader',\n children: [\n { name: 'Loading App 1', id: 'SelNodesTreeView-LoadApp1' },\n { name: 'Loading App 2', id: 'SelNodesTreeView-LoadApp2' },\n { name: 'Loading App 3', id: 'SelNodesTreeView-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'SelNodesTreeView-Cost',\n children: [\n {\n name: 'Application 3',\n id: 'SelNodesTreeView-App3',\n children: [\n { name: 'Settings', id: 'SelNodesTreeView-App3Settings' },\n { name: 'Current', id: 'SelNodesTreeView-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'SelNodesTreeView-Sources',\n children: [\n {\n name: 'Application 4',\n id: 'SelNodesTreeView-App4',\n children: [{ name: 'Settings', id: 'SelNodesTreeView-App4Settings' }]\n }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'SelNodesTreeView-Long',\n children: [{ name: 'Application 5', id: 'SelNodesTreeView-App5' }]\n }\n ];\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View separate selection and expansion example\"\n hasSelectableNodes\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n />\n );\n};\n","title":"With separate selection and expansion","lang":"ts","className":""}}>
333
-
334
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
335
- {`The `}
336
-
337
- <code {...{"className":"ws-code "}}>
338
- {`hasSelectableNodes`}
339
- </code>
340
- {` modifier will separate the expansion and selection behaviors, allowing a parent node to be selected or deselected without toggling its expansion.`}
341
- </p>
342
- </Example>,
343
- 'With search': props =>
344
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n Toolbar,\n ToolbarContent,\n ToolbarItem,\n TreeView,\n TreeViewDataItem,\n TreeViewSearch\n} from '@patternfly/react-core';\nexport const TreeViewWithSearch: React.FunctionComponent = () => {\n const options = [\n {\n name: 'Application launcher',\n id: 'example2-AppLaunch',\n children: [\n {\n name: 'Application 1',\n id: 'example2-App1',\n children: [\n { name: 'Settings', id: 'example2-App1Settings' },\n { name: 'Current', id: 'example2-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'example2-App2',\n children: [\n { name: 'Settings', id: 'example2-App2Settings' },\n {\n name: 'Loader',\n id: 'example2-App2Loader',\n children: [\n { name: 'Loading App 1', id: 'example2-LoadApp1' },\n { name: 'Loading App 2', id: 'example2-LoadApp2' },\n { name: 'Loading App 3', id: 'example2-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'example2-Cost',\n children: [\n {\n name: 'Application 3',\n id: 'example2-App3',\n children: [\n { name: 'Settings', id: 'example2-App3Settings' },\n { name: 'Current', id: 'example2-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'example2-Sources',\n children: [\n {\n name: 'Application 4',\n id: 'example2-App4',\n children: [{ name: 'Settingexample2-s', id: 'example2-App4Settings' }]\n }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'example2-Long',\n children: [{ name: 'Application 5', id: 'example2-App5' }]\n }\n ];\n\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n const [filteredItems, setFilteredItems] = useState(options);\n const [isFiltered, setIsFiltered] = useState(false);\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n // Ignore folders for selection\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems([treeViewItem]);\n }\n };\n\n const onSearch = (event: React.ChangeEvent<HTMLInputElement>) => {\n const input = event.target.value;\n if (input === '') {\n setFilteredItems(options);\n setIsFiltered(false);\n } else {\n const filtered = options.map((opt) => Object.assign({}, opt)).filter((item) => filterItems(item, input));\n setFilteredItems(filtered);\n setIsFiltered(true);\n }\n };\n const filterItems = (item, input) => {\n if (item.name.toLowerCase().includes(input.toLowerCase())) {\n return true;\n }\n if (item.children) {\n return (\n (item.children = item.children\n .map((opt) => Object.assign({}, opt))\n .filter((child) => filterItems(child, input))).length > 0\n );\n }\n };\n const toolbar = (\n <Toolbar style={{ padding: 0 }}>\n <ToolbarContent style={{ padding: 0 }}>\n <ToolbarItem>\n <TreeViewSearch onSearch={onSearch} id=\"input-search\" name=\"search-input\" aria-label=\"Search input example\" />\n </ToolbarItem>\n </ToolbarContent>\n </Toolbar>\n );\n\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View with search example\"\n data={filteredItems}\n activeItems={activeItems}\n onSelect={onSelect}\n allExpanded={isFiltered}\n toolbar={toolbar}\n />\n );\n};\n","title":"With search","lang":"ts","className":""}}>
345
-
346
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
347
- {`A search input can be used to filter tree view items. It is recommended that a tree view with more than 7 nodes includes a search input.`}
348
- </p>
349
- </Example>,
350
- 'With checkboxes': props =>
351
- <Example {...pageData} {...props} {...{"code":"import { useEffect, useState } from 'react';\nimport { TreeView, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewWithCheckboxes: React.FunctionComponent = () => {\n const [checkedItems, setCheckedItems] = useState<TreeViewDataItem[]>([]);\n\n useEffect(() => {\n // eslint-disable-next-line no-console\n console.log('Checked items: ', checkedItems);\n }, [checkedItems]);\n\n const options = [\n {\n name: 'Application launcher',\n id: 'example3-AppLaunch',\n checkProps: { 'aria-label': 'app-launcher-check', checked: false },\n children: [\n {\n name: 'Application 1',\n id: 'example3-App1',\n checkProps: { checked: false },\n children: [\n {\n name: 'Settings',\n id: 'example3-App1Settings',\n checkProps: { checked: false }\n },\n {\n name: 'Current',\n id: 'example3-App1Current',\n checkProps: { checked: false }\n }\n ]\n },\n {\n name: 'Application 2',\n id: 'example3-App2',\n checkProps: { checked: false },\n children: [\n {\n name: 'Settings',\n id: 'example3-App2Settings',\n checkProps: { checked: false }\n },\n {\n name: 'Loader',\n id: 'example3-App2Loader',\n checkProps: { checked: false },\n children: [\n {\n name: 'Loading App 1',\n id: 'example3-LoadApp1',\n checkProps: { checked: false }\n },\n {\n name: 'Loading App 2',\n id: 'example3-LoadApp2',\n checkProps: { checked: false }\n },\n {\n name: 'Loading App 3',\n id: 'example3-LoadApp3',\n checkProps: { checked: false }\n }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'example3-Cost',\n checkProps: { 'aria-label': 'cost-check', checked: false },\n children: [\n {\n name: 'Application 3',\n id: 'example3-App3',\n checkProps: { 'aria-label': 'app-3-check', checked: false },\n children: [\n {\n name: 'Settings',\n id: 'example3-App3Settings',\n checkProps: { 'aria-label': 'app-3-settings-check', checked: false }\n },\n {\n name: 'Current',\n id: 'example3-App3Current',\n checkProps: { 'aria-label': 'app-3-current-check', checked: false }\n }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'example3-Sources',\n checkProps: { 'aria-label': 'sources-check', checked: false },\n children: [\n {\n name: 'Application 4',\n id: 'example3-App4',\n checkProps: { 'aria-label': 'app-4-check', checked: false },\n children: [\n {\n name: 'Settings',\n id: 'example3-App4Settings',\n checkProps: { 'aria-label': 'app-4-settings-check', checked: false }\n }\n ]\n }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'example3-Long',\n checkProps: { 'aria-label': 'long-check', checked: false },\n children: [\n { name: 'Application 5', id: 'example3-App5', checkProps: { 'aria-label': 'app-5-check', checked: false } }\n ]\n }\n ];\n\n const onCheck = (event: React.ChangeEvent, treeViewItem: TreeViewDataItem) => {\n const checked = (event.target as HTMLInputElement).checked;\n\n const checkedItemTree = options\n .map((opt) => Object.assign({}, opt))\n .filter((item) => filterItems(item, treeViewItem));\n const flatCheckedItems = flattenTree(checkedItemTree);\n\n setCheckedItems((prevCheckedItems) =>\n checked\n ? prevCheckedItems.concat(flatCheckedItems.filter((item) => !checkedItems.some((i) => i.id === item.id)))\n : prevCheckedItems.filter((item) => !flatCheckedItems.some((i) => i.id === item.id))\n );\n };\n\n // Helper functions\n const isChecked = (dataItem: TreeViewDataItem) => checkedItems.some((item) => item.id === dataItem.id);\n const areAllDescendantsChecked = (dataItem: TreeViewDataItem) =>\n dataItem.children ? dataItem.children.every((child) => areAllDescendantsChecked(child)) : isChecked(dataItem);\n const areSomeDescendantsChecked = (dataItem: TreeViewDataItem) =>\n dataItem.children ? dataItem.children.some((child) => areSomeDescendantsChecked(child)) : isChecked(dataItem);\n\n const flattenTree = (tree: TreeViewDataItem[]) => {\n let result: TreeViewDataItem[] = [];\n tree.forEach((item) => {\n result.push(item);\n if (item.children) {\n result = result.concat(flattenTree(item.children));\n }\n });\n return result;\n };\n\n const mapTree = (item: TreeViewDataItem) => {\n const hasCheck = areAllDescendantsChecked(item);\n // Reset checked properties to be updated\n if (item.checkProps) {\n item.checkProps.checked = false;\n\n if (hasCheck) {\n item.checkProps.checked = true;\n } else {\n const hasPartialCheck = areSomeDescendantsChecked(item);\n if (hasPartialCheck) {\n item.checkProps.checked = null;\n }\n }\n\n if (item.children) {\n return {\n ...item,\n children: item.children.map((child) => mapTree(child))\n };\n }\n }\n return item;\n };\n\n const filterItems = (item: TreeViewDataItem, checkedItem: TreeViewDataItem) => {\n if (item.id === checkedItem.id) {\n return true;\n }\n\n if (item.children) {\n return (\n (item.children = item.children\n .map((opt) => Object.assign({}, opt))\n .filter((child) => filterItems(child, checkedItem))).length > 0\n );\n }\n };\n const mapped = options.map((item) => mapTree(item));\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View with checkboxes example\"\n data={mapped}\n onCheck={onCheck}\n hasCheckboxes\n />\n );\n};\n","title":"With checkboxes","lang":"ts","className":""}}>
352
-
353
- </Example>,
354
- 'With icons': props =>
355
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TreeView, TreeViewDataItem } from '@patternfly/react-core';\nimport FolderIcon from '@patternfly/react-icons/dist/esm/icons/folder-icon';\nimport FolderOpenIcon from '@patternfly/react-icons/dist/esm/icons/folder-open-icon';\n\nexport const TreeViewWithIcons: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n // Ignore folders for selection\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems([treeViewItem]);\n }\n };\n const options = [\n {\n name: 'Application launcher',\n id: 'example4-AppLaunch',\n children: [\n {\n name: 'Application 1',\n id: 'example4-App1',\n children: [\n { name: 'Settings', id: 'example4-App1Settings' },\n { name: 'Current', id: 'example4-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'example4-App2',\n children: [\n { name: 'Settings', id: 'example4-App2Settings' },\n {\n name: 'Loader',\n id: 'example4-App2Loader',\n children: [\n { name: 'Loading App 1', id: 'example4-LoadApp1' },\n { name: 'Loading App 2', id: 'example4-LoadApp2' },\n { name: 'Loading App 3', id: 'example4-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'example4-Cost',\n children: [\n {\n name: 'Application 3',\n id: 'example4-App3',\n children: [\n { name: 'Settings', id: 'example4-App3Settings' },\n { name: 'Current', id: 'example4-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'example4-Sources',\n children: [\n { name: 'Application 4', id: 'example4-App4', children: [{ name: 'Settings', id: 'example4-App4Settings' }] }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'example4-Long',\n children: [{ name: 'Application 5', id: 'example4-App5' }]\n }\n ];\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View with icons example\"\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n icon={<FolderIcon />}\n expandedIcon={<FolderOpenIcon />}\n />\n );\n};\n","title":"With icons","lang":"ts","className":""}}>
356
-
357
- </Example>,
358
- 'With unique icon per item': props =>
359
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TreeView, TreeViewDataItem } from '@patternfly/react-core';\nimport GitlabIcon from '@patternfly/react-icons/dist/esm/icons/gitlab-icon';\nimport GithubIcon from '@patternfly/react-icons/dist/esm/icons/github-icon';\nimport GoogleIcon from '@patternfly/react-icons/dist/esm/icons/google-icon';\n\nexport const TreeViewWithIconPerItem: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n // Ignore folders for selection\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems([treeViewItem]);\n }\n };\n const options: TreeViewDataItem[] = [\n {\n name: 'Github accounts',\n id: 'iconPerItem-Github',\n icon: <GithubIcon />,\n children: [\n {\n name: 'Account 1',\n id: 'iconPerItem-Acc1'\n },\n {\n name: 'Account 2',\n id: 'iconPerItem-Acc2'\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Gitlab accounts',\n id: 'iconPerItem-Gitlab',\n icon: <GitlabIcon />,\n children: [\n {\n name: 'Account 3',\n id: 'iconPerItem-Acc3'\n }\n ]\n },\n {\n name: 'Google accounts',\n id: 'iconPerItem-Google',\n icon: <GoogleIcon />,\n children: [\n {\n name: 'Account 4',\n id: 'iconPerItem-Acc4'\n }\n ]\n }\n ];\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View with unique icon per item example\"\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n />\n );\n};\n","title":"With unique icon per item","lang":"ts","className":""}}>
360
-
361
- </Example>,
362
- 'With badges': props =>
363
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TreeView, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewBadges: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n // Ignore folders for selection\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems([treeViewItem]);\n }\n };\n\n const options = [\n {\n name: 'Application launcher',\n id: 'example5-AppLaunch',\n children: [\n {\n name: 'Application 1',\n id: 'example5-App1',\n children: [\n { name: 'Settings', id: 'example5-App1Settings' },\n { name: 'Current', id: 'example5-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'example5-App2',\n children: [\n { name: 'Settings', id: 'example5-App2Settings' },\n {\n name: 'Loader',\n id: 'example5-App2Loader',\n children: [\n { name: 'Loading App 1', id: 'example5-LoadApp1' },\n { name: 'Loading App 2', id: 'example5-LoadApp2' },\n { name: 'Loading App 3', id: 'example5-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'example5-Cost',\n children: [\n {\n name: 'Application 3',\n id: 'example5-App3',\n children: [\n { name: 'Settings', id: 'example5-App3Settings' },\n { name: 'Current', id: 'example5-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'example5-Sources',\n children: [\n {\n name: 'Application 4',\n id: 'example5-App4',\n children: [{ name: 'Settings', id: 'example5-App4Settings' }]\n }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'example5-Long',\n children: [{ name: 'Application 5', id: 'example5-App5' }]\n }\n ];\n\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View with badges example\"\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n hasBadges\n />\n );\n};\n","title":"With badges","lang":"ts","className":""}}>
364
-
365
- </Example>,
366
- 'With custom badges': props =>
367
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TreeView, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewCustomBadges: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n // Ignore folders for selection\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems([treeViewItem]);\n }\n };\n const options = [\n {\n name: 'Application launcher',\n id: 'example6-AppLaunch',\n customBadgeContent: '2 applications',\n children: [\n {\n name: 'Application 1',\n id: 'example6-App1',\n customBadgeContent: '2 children',\n children: [\n { name: 'Settings', id: 'example6-App1Settings' },\n { name: 'Current', id: 'example6-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'example6-App2',\n customBadgeContent: '2 children',\n children: [\n { name: 'Settings', id: 'example6-App2Settings' },\n {\n name: 'Loader',\n id: 'example6-App2Loader',\n customBadgeContent: '3 loading apps',\n children: [\n { name: 'Loading app 1', id: 'example6-LoadApp1' },\n { name: 'Loading app 2', id: 'example6-LoadApp2' },\n { name: 'Loading app 3', id: 'example6-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'example6-Cost',\n customBadgeContent: '1 applications',\n children: [\n {\n name: 'Application 3',\n id: 'example6-App3',\n customBadgeContent: '2 children',\n children: [\n { name: 'Settings', id: 'example6-App3Settings' },\n { name: 'Current', id: 'example6-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'example6-Sources',\n customBadgeContent: '1 source',\n children: [\n {\n name: 'Application 4',\n id: 'example6-App4',\n customBadgeContent: '1 child',\n children: [{ name: 'Settings', id: 'example6-App4Settings' }]\n }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'example6-Long',\n customBadgeContent: '1 application',\n children: [{ name: 'Application 5', id: 'example6-App5' }]\n }\n ];\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View with custom badges example\"\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n hasBadges\n />\n );\n};\n","title":"With custom badges","lang":"ts","className":""}}>
368
-
369
- </Example>,
370
- 'With action items': props =>
371
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n TreeView,\n Button,\n Dropdown,\n DropdownList,\n DropdownItem,\n MenuToggle,\n TreeViewDataItem\n} from '@patternfly/react-core';\nimport RhUiClipboardFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-clipboard-fill-icon';\nimport RhUiStorageFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-storage-fill-icon';\nimport RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';\n\nexport const TreeViewWithActionItems: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n const [isOpen, setIsOpen] = useState<boolean>(false);\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n // Ignore folders for selection\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems([treeViewItem]);\n }\n };\n\n const onToggle = () => {\n setIsOpen((prevIsOpen) => !prevIsOpen);\n };\n\n const onAppLaunchSelect = () => {\n setIsOpen((prevIsOpen) => !prevIsOpen);\n };\n\n const options = [\n {\n name: 'Application launcher',\n id: 'example7-AppLaunch',\n action: (\n <Dropdown\n onSelect={onAppLaunchSelect}\n isOpen={isOpen}\n onOpenChange={(isOpen) => setIsOpen(isOpen)}\n toggle={(toggleRef) => (\n <MenuToggle\n ref={toggleRef}\n isExpanded={isOpen}\n onClick={onToggle}\n variant=\"plain\"\n aria-label=\"Tree view with actions example kebab toggle\"\n icon={<RhUiEllipsisVerticalFillIcon />}\n />\n )}\n >\n <DropdownList>\n <DropdownItem>Action</DropdownItem>\n <DropdownItem\n to=\"#default-link2\"\n // Prevent the default onClick functionality for example purposes\n onClick={(ev) => ev.preventDefault()}\n >\n Link\n </DropdownItem>\n <DropdownItem isDisabled>Disabled Action</DropdownItem>\n <DropdownItem isDisabled to=\"#default-link4\">\n Disabled Link\n </DropdownItem>\n </DropdownList>\n </Dropdown>\n ),\n children: [\n {\n name: 'Application 1',\n id: 'example7-App1',\n action: <Button variant=\"plain\" aria-label=\"Launch app 1\" icon={<RhUiClipboardFillIcon />} />,\n actionProps: {\n 'aria-label': 'Launch app 1'\n },\n children: [\n { name: 'Settings', id: 'example7-App1Settings' },\n { name: 'Current', id: 'example7-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'example7-App2',\n action: <Button variant=\"plain\" aria-label=\"Launch app 2\" icon={<RhUiStorageFillIcon />} />,\n children: [\n { name: 'Settings', id: 'example7-App2Settings' },\n {\n name: 'Loader',\n id: 'example7-App2Loader',\n children: [\n { name: 'Loading App 1', id: 'example7-LoadApp1' },\n { name: 'Loading App 2', id: 'example7-LoadApp2' },\n { name: 'Loading App 3', id: 'example7-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'example7-Cost',\n children: [\n {\n name: 'Application 3',\n id: 'example7-App3',\n children: [\n { name: 'Settings', id: 'example7-App3Settings' },\n { name: 'Current', id: 'example7-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'example7-Sources',\n children: [\n { name: 'Application 4', id: 'example7-App4', children: [{ name: 'Settings', id: 'example7-App4Settings' }] }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'example7-Long',\n children: [{ name: 'Application 5', id: 'example7-App5' }]\n }\n ];\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View with actions example\"\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n />\n );\n};\n","title":"With action items","lang":"ts","className":""}}>
372
-
373
- </Example>,
374
- 'Guides': props =>
375
- <Example {...pageData} {...props} {...{"code":"import { TreeView, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const GuidesTreeView: React.FunctionComponent = () => {\n const options: TreeViewDataItem[] = [\n {\n name: 'Application launcher',\n id: 'example8-AppLaunch',\n children: [\n {\n name: 'Application 1',\n id: 'example8-App1',\n children: [\n { name: 'Settings', id: 'example8-App1Settings' },\n { name: 'Current', id: 'example8-App1Current' }\n ]\n },\n {\n name: 'Application 2',\n id: 'example8-App2',\n children: [\n { name: 'Settings', id: 'example8-App2Settings' },\n {\n name: 'Loader',\n id: 'example8-App2Loader',\n children: [\n { name: 'Loading App 1', id: 'example8-LoadApp1' },\n { name: 'Loading App 2', id: 'example8-LoadApp2' },\n { name: 'Loading App 3', id: 'example8-LoadApp3' }\n ]\n }\n ]\n }\n ],\n defaultExpanded: true\n },\n {\n name: 'Cost management',\n id: 'example8-Cost',\n children: [\n {\n name: 'Application 3',\n id: 'example8-App3',\n children: [\n { name: 'Settings', id: 'example8-App3Settings' },\n { name: 'Current', id: 'example8-App3Current' }\n ]\n }\n ]\n },\n {\n name: 'Sources',\n id: 'example8-Sources',\n children: [\n { name: 'Application 4', id: 'example8-App4', children: [{ name: 'Settings', id: 'example8-App4Settings' }] }\n ]\n },\n {\n name: 'Really really really long folder name that overflows the container it is in',\n id: 'example8-Long',\n children: [{ name: 'Application 5', id: 'example8-App5' }]\n }\n ];\n return <TreeView hasAnimations aria-label=\"Tree View guides example\" data={options} hasGuides={true} />;\n};\n","title":"Guides","lang":"ts","className":""}}>
376
-
377
- </Example>,
378
- 'Compact': props =>
379
- <Example {...pageData} {...props} {...{"code":"import { TreeView, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewCompact: React.FunctionComponent = () => {\n const options: TreeViewDataItem[] = [\n {\n name: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value and may reject unrecognized values.',\n title: 'apiVersion',\n id: 'example9-apiVersion'\n },\n {\n name: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated is CamelCase. More info:',\n title: 'kind',\n id: 'example9-kind'\n },\n {\n name: 'Standard metadata object',\n title: 'metadata',\n id: 'example9-metadata'\n },\n {\n name: 'Standard metadata object',\n title: 'spec',\n id: 'example9-spec',\n children: [\n {\n name: 'Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Default to 0 (pod will be considered available as soon as it is ready).',\n title: 'minReadySeconds',\n id: 'example9-minReadySeconds'\n },\n {\n name: 'Indicates that the deployment is paused',\n title: 'paused',\n id: 'example9-paused'\n },\n {\n name: 'The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that the progress will not de estimated during the time a deployment is paused. Defaults to 600s.',\n title: 'progressDeadlineSeconds',\n id: 'example9-progressDeadlineSeconds',\n children: [\n {\n name: 'The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.',\n title: 'revisionHistoryLimit',\n id: 'example9-revisionHistoryLimit',\n children: [\n {\n name: 'Map of {key.value} pairs. A single {key.value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\" and the values array contains only \"value\". The requirements are ANDed.',\n title: 'matchLabels',\n id: 'example9-matchLabels'\n }\n ]\n }\n ]\n }\n ]\n }\n ];\n return <TreeView hasAnimations aria-label=\"Tree View compact example\" data={options} variant=\"compact\" />;\n};\n","title":"Compact","lang":"ts","className":""}}>
380
-
381
- </Example>,
382
- 'Compact, no background': props =>
383
- <Example {...pageData} {...props} {...{"code":"import { TreeView, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewCompactNoBackground: React.FunctionComponent = () => {\n const options: TreeViewDataItem[] = [\n {\n name: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value and may reject unrecognized values.',\n title: 'apiVersion',\n id: 'example10-apiVersion'\n },\n {\n name: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated is CamelCase. More info:',\n title: 'kind',\n id: 'example10-kind'\n },\n {\n name: 'Standard metadata object',\n title: 'metadata',\n id: 'example10-metadata'\n },\n {\n name: 'Standard metadata object',\n title: 'spec',\n id: 'example10-spec',\n children: [\n {\n name: 'Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Default to 0 (pod will be considered available as soon as it is ready).',\n title: 'minReadySeconds',\n id: 'example10-minReadySeconds'\n },\n {\n name: 'Indicates that the deployment is paused',\n title: 'paused',\n id: 'example10-paused'\n },\n {\n name: 'The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that the progress will not de estimated during the time a deployment is paused. Defaults to 600s.',\n title: 'progressDeadlineSeconds',\n id: 'example10-progressDeadlineSeconds',\n children: [\n {\n name: 'The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.',\n title: 'revisionHistoryLimit',\n id: 'example10-revisionHistoryLimit',\n children: [\n {\n name: 'Map of {key.value} pairs. A single {key.value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\" and the values array contains only \"value\". The requirements are ANDed.',\n title: 'matchLabels',\n id: 'example10-matchLabels'\n }\n ]\n }\n ]\n }\n ]\n }\n ];\n return (\n <TreeView\n hasAnimations\n aria-label=\"Tree View compact no background example\"\n data={options}\n variant=\"compactNoBackground\"\n />\n );\n};\n","title":"Compact, no background","lang":"ts","className":""}}>
384
-
385
- </Example>,
386
- 'With memoization': props =>
387
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { TreeView, Button, TreeViewDataItem } from '@patternfly/react-core';\n\nexport const TreeViewWithMemoization: React.FunctionComponent = () => {\n const [activeItems, setActiveItems] = useState<TreeViewDataItem[]>();\n const [allExpanded, setAllExpanded] = useState(false);\n\n const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {\n const filtered: TreeViewDataItem[] = [];\n options.forEach((item) => filterItems(item, treeViewItem.id, filtered));\n if (treeViewItem && !treeViewItem.children) {\n setActiveItems(filtered);\n }\n };\n\n const onToggle = (_event: React.MouseEvent) => {\n setAllExpanded((prevAllExpanded) => !prevAllExpanded);\n };\n\n const filterItems = (item: TreeViewDataItem, input: string | undefined, list: TreeViewDataItem[]) => {\n if (item.children) {\n let childContained = false;\n item.children.forEach((child) => {\n if (childContained) {\n filterItems(child, input, list);\n } else {\n childContained = filterItems(child, input, list);\n }\n });\n if (childContained) {\n list.push(item);\n }\n }\n\n if (item.id === input) {\n list.push(item);\n return true;\n } else {\n return false;\n }\n };\n\n const options: TreeViewDataItem[] = [];\n for (let i = 1; i <= 20; i++) {\n const childNum = 5;\n const childOptions: TreeViewDataItem[] = [];\n for (let j = 1; j <= childNum; j++) {\n childOptions.push({ name: 'Child ' + j, id: `Option${i} - Child${j}` });\n }\n options.push({ name: 'Option ' + i, id: i.toString(), children: childOptions });\n }\n const tree = (\n <TreeView\n hasAnimations\n aria-label=\"Tree View with memoization example\"\n data={options}\n activeItems={activeItems}\n onSelect={onSelect}\n allExpanded={allExpanded}\n useMemo\n />\n );\n\n return (\n <Fragment>\n <Button variant=\"link\" onClick={onToggle}>\n {allExpanded && 'Collapse all'}\n {!allExpanded && 'Expand all'}\n </Button>\n {tree}\n </Fragment>\n );\n};\n","title":"With memoization","lang":"ts","className":""}}>
388
-
389
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
390
- {`Turning on memoization with the `}
391
-
392
- <code {...{"className":"ws-code "}}>
393
- {`useMemo`}
394
- </code>
395
- {` property helps prevent unnecessary re-renders for large data sets. With this flag active, `}
396
-
397
- <code {...{"className":"ws-code "}}>
398
- {`activeItems`}
399
- </code>
400
- {` must pass in an array of nodes along the selected item's path to update properly.`}
401
- </p>
402
- </Example>
403
- };
404
-
405
- const Component = () => (
406
- <React.Fragment>
407
- <AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
408
- {`Examples`}
409
- </AutoLinkHeader>
410
- {React.createElement(pageData.examples["Single selectable"])}
411
- {React.createElement(pageData.examples["Multiselectable"])}
412
- {React.createElement(pageData.examples["With separate selection and expansion"])}
413
- {React.createElement(pageData.examples["With search"])}
414
- {React.createElement(pageData.examples["With checkboxes"])}
415
- {React.createElement(pageData.examples["With icons"])}
416
- {React.createElement(pageData.examples["With unique icon per item"])}
417
- {React.createElement(pageData.examples["With badges"])}
418
- {React.createElement(pageData.examples["With custom badges"])}
419
- {React.createElement(pageData.examples["With action items"])}
420
- {React.createElement(pageData.examples["Guides"])}
421
- {React.createElement(pageData.examples["Compact"])}
422
- {React.createElement(pageData.examples["Compact, no background"])}
423
- {React.createElement(pageData.examples["With memoization"])}
424
- </React.Fragment>
425
- );
426
- Component.displayName = 'ComponentsTreeViewReactDocs';
427
- Component.pageData = pageData;
428
-
429
- export default Component;