@patternfly/react-core 4.276.0 → 4.276.1

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.276.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@4.276.0...@patternfly/react-core@4.276.1) (2023-01-20)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-core
9
+
10
+
11
+
12
+
13
+
6
14
  # [4.276.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@4.275.0...@patternfly/react-core@4.276.0) (2023-01-19)
7
15
 
8
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.276.0",
3
+ "version": "4.276.1",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -71,5 +71,5 @@
71
71
  "react": "^16.8 || ^17 || ^18",
72
72
  "react-dom": "^16.8 || ^17 || ^18"
73
73
  },
74
- "gitHead": "7b3cf4f9f882639970c7b885d72f7153be97e652"
74
+ "gitHead": "fadcd39108e98e73cb899387f4a82f490807443a"
75
75
  }
@@ -18,114 +18,173 @@ import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-ico
18
18
 
19
19
  ## Examples
20
20
 
21
- ### Basic
21
+ ### Basic menus
22
+
23
+ A menu may contain multiple variations of `<MenuItem>` components. The following example shows a few different states of menu items, where they may:
24
+
25
+ - Use the `itemId` property to link to callbacks. In this example, the `onSelect` property logs information to the console when a menu item is selected. In practice, specific actions can be linked to `onSelect` callbacks.
26
+ - Use the `to` property to direct users to other resources or webpages after selecting a menu item, and the `onClick` property to pass in a callback for specific menu items.
27
+ - Use the `isDisabled` property to disable a menu item.
28
+ - Use the `isPlain` property to remove the outer box shadow and style the menu plainly instead.
22
29
 
23
30
  ```ts file="MenuBasic.tsx"
24
31
  ```
25
32
 
26
33
  ### Danger menu item
27
34
 
35
+ To indicate that a `<MenuItem>` is connected to a potentially destructive action, use the `isDanger` property. The "Delete" item in the following example demonstrates how danger items look.
36
+
28
37
  ```ts file="MenuDangerMenuItem.tsx"
29
38
  ```
30
39
 
31
40
  ### With icons
32
41
 
42
+ Use the `icon` property to add a familiar icon before a `<MenuItem>` to accelerate text label recognition.
43
+
33
44
  ```ts file="MenuWithIcons.tsx"
34
45
  ```
35
46
 
36
- ### With checkbox
47
+ ### With actions
48
+
49
+ To connect a menu item to an action icon, add a `<MenuItemAction>` to a `<MenuItem>`, and use the `icon` property to load an easily recognizable icon.
37
50
 
38
- ```ts file="./MenuWithCheckbox.tsx"
39
- ```
51
+ To trigger an action when any menu action icon is selected, pass a callback to the `onActionClick` property of the `<Menu>`. The following example logs to the console any time any action icon is selected.
40
52
 
41
- ### Filtering with search input
53
+ To trigger an action when a specific item's action icon is selected, pass in the `onClick` property to that `<MenuItemAction>`. The following example logs "clicked on code icon" to the console when the "code" icon is selected.
42
54
 
43
- ```ts file="MenuFilteringWithSearchInput.tsx"
55
+ ```ts file="MenuWithActions.tsx"
44
56
  ```
45
57
 
46
58
  ### With links
47
59
 
60
+ Use the `to` property to add a link to a `<MenuItem>` that directs users to a new page when the item is selected. Use the `isExternalLink` property when linking to external resources. This will annotate a menu item link with an external link icon when they navigate to the link or hover over it.
61
+
48
62
  ```ts file="MenuWithLinks.tsx"
49
63
  ```
50
64
 
51
- ### With separator(s)
65
+ ### With descriptions
52
66
 
53
- ```ts file="MenuWithSeparators.tsx"
67
+ Use the `description` property to add short descriptive text below any menu item that needs additional context.
68
+
69
+ ```ts file="MenuWithDescription.tsx"
54
70
  ```
55
71
 
56
- ### With titled groups
72
+ ### Item checkbox
57
73
 
58
- ```ts file="MenuWithTitledGroups.tsx"
74
+ Use the `hasCheck` property to add a checkbox to a `<MenuItem>`. Use the `isSelected` property to indicate when a `<MenuItem>` is selected.
75
+
76
+ ```ts file="./MenuWithCheckbox.tsx" isBeta
59
77
  ```
60
78
 
61
- ### With description
79
+ ### Menu footer
62
80
 
63
- ```ts file="MenuWithDescription.tsx"
81
+ Add a `<MenuFooter>` that contains separate, but related actions at the bottom of a menu.
82
+
83
+ ```ts file="MenuWithFooter.tsx"
64
84
  ```
65
85
 
66
- ### With actions
86
+ ### Separated items
67
87
 
68
- ```ts file="MenuWithActions.tsx"
88
+ Use a [divider](/components/divider) to visually separate `<MenuContent>`. Use the `component` property to specify the type of divider component to use.
89
+
90
+ ```ts file="MenuWithSeparators.tsx"
91
+ ```
92
+
93
+ ### Titled groups of items
94
+
95
+ Add a `<MenuGroup>` to organize `<MenuContent>` and use the `label` property to title a group of menu items. Use the `labelHeadingLevel` property to assign a heading level to the menu group label.
96
+
97
+ ```ts file="MenuWithTitledGroups.tsx"
69
98
  ```
70
99
 
71
100
  ### With favorites
72
101
 
102
+ The following menu example allows users to favorite menu items, an action that duplicates a menu item and places it in a separate group at the top of the menu. The `isFavorited` property identifies items that a user has favorited.
103
+
73
104
  ```ts file="MenuWithFavorites.tsx"
74
105
  ```
75
106
 
76
- ### Option single select
107
+ ### Filtering with search input
108
+
109
+ A [search input](/components/search-input) component can be placed within `<MenuInput>` to render a search input at the top of the menu. In the following example, the `onChange` property of the text input is passed a callback that filters menu items as a user types.
110
+
111
+ ```ts file="MenuFilteringWithSearchInput.tsx"
112
+ ```
113
+
114
+ ### Option single select menu
115
+
116
+ The following example demonstrates a single option select menu that persists a selected menu item. Use the `selected` property on the `<Menu>` to label a selected item with a checkmark. You can also use the `isSelected` property on a `<MenuItem>` to indicate that it is selected.
77
117
 
78
118
  ```ts file="MenuOptionSingleSelect.tsx"
79
119
  ```
80
120
 
81
- ### Option multi select
121
+ ### Option multi select menu
122
+
123
+ To persist multiple selections that a user makes, use a multiple option select menu. To enable multi select, pass an array containing each selected `itemId` to the `selected` property.
82
124
 
83
125
  ```ts file="MenuOptionMultiSelect.tsx"
84
126
  ```
85
127
 
86
- ### With drilldown
128
+ ### Scrollable menus
87
129
 
88
- ```ts file="./MenuWithDrilldown.tsx" isBeta
130
+ Use the `isScrollable` property to make a long `<Menu>` scrollable and visually condensed.
131
+
132
+ ```ts file="MenuScrollable.tsx"
89
133
  ```
90
134
 
91
- ### With drilldown - initial drill in state
135
+ ### Scrollable menu with custom height
92
136
 
93
- To render an initially drilled in menu, the `menuDrilledIn`, `drilldownPath`, and `activeMenu` states must be set to an initial state. The `menuHeights` state must also be set, defining the height of the root menu. The `setHeight` function passed into the `onGetMenuHeight` property must also account for updating heights, other than the root menu, as menus drill in and out of view.
137
+ Adjust the visual size of a scrollable menu by using the `menuHeight` property within `<MenuContent>`. This example adjusts the height to 200px.
94
138
 
95
- ```ts file="./MenuWithDrilldownInitialState.tsx" isBeta
139
+ ```ts file="MenuScrollableCustomMenuHeight.tsx"
96
140
  ```
97
141
 
98
- ### With drilldown - submenu functions
142
+ ### With view more
99
143
 
100
- ```ts file="./MenuWithDrilldownSubmenuFunctions.tsx" isBeta
101
- ```
144
+ If you want to initially render only a certain number of menu items within a large menu, you can add a "view more" menu item with a callback passed into its `onClick` property that will render additional menu items.
102
145
 
103
- ### With drilldown breadcrumbs
146
+ In this example, 3 additional menu items are revealed each time the "view more" option is selected, with a loading icon simulating a network call to fetch more items. After all items are visible, the "view more" link disappears.
104
147
 
105
- ```ts file="MenuWithDrilldownBreadcrumbs.tsx" isBeta
148
+ ```ts file="MenuWithViewMore.tsx"
106
149
  ```
107
150
 
108
- ### With drilldown and inline filter
151
+ ### With drilldown
109
152
 
110
- ```ts file="MenuFilterDrilldown.tsx"
111
- ```
153
+ Use a drilldown menu to contain different levels of menu items. When a parent menu item (an item that has a submenu of children) is selected, the menu is replaced with the children items.
112
154
 
113
- ### Scrollable
155
+ - To indicate that a menu contains a drilldown, use the `containsDrilldown` property.
156
+ - To indicate the path of drilled-in menu item ids, use the `drilldownItemPath` property.
157
+ - Pass in an array of drilled-in menus with the `drilledInMenus` property.
158
+ - Use the `onDrillIn` and `onDrillOut` properties to contain callbacks for drilling into and drilling out of a submenu, respectively.
159
+ - To account for updated heights as menus drill in and out of use, use the `onGetMenuHeight` property. When starting from a drilled-in state, the `onGetMenuHeight` property must define the height of the root menu.
114
160
 
115
- ```ts file="MenuScrollable.tsx"
161
+ ```ts file="./MenuWithDrilldown.tsx" isBeta
116
162
  ```
117
163
 
118
- ### Scrollable with custom menu height
164
+ ### Initially drilled-in menu
119
165
 
120
- ```ts file="MenuScrollableCustomMenuHeight.tsx"
166
+ To render an initially drilled-in menu, the `drilldownItemPath`, `drilledInMenus`, and `activeMenu` properties must be set to default values.
167
+
168
+ ```ts file="./MenuWithDrilldownInitialState.tsx" isBeta
121
169
  ```
122
170
 
123
- ### With footer
171
+ ### With drilldown - submenu functions
124
172
 
125
- ```ts file="MenuWithFooter.tsx"
173
+ For added flexibility with large menus, you may create a menu by passing a function to `drilldownMenu`. This approach allows you to create menu items dynamically, rather than creating everything up front.
174
+
175
+ ```ts file="./MenuWithDrilldownSubmenuFunctions.tsx" isBeta
126
176
  ```
127
177
 
128
- ### With view more
178
+ ### With drilldown breadcrumbs
129
179
 
130
- ```ts file="MenuWithViewMore.tsx"
180
+ Use [breadcrumbs](/components/breadcrumb) when a drilldown menu has more than 2 levels to offer users better navigation.
181
+
182
+ To control the height of a menu, use the `maxMenuHeight` property. Selecting the "Set max menu height" checkbox in the following example sets the menu height to "100px" and makes the menu scrollable.
183
+
184
+ ```ts file="MenuWithDrilldownBreadcrumbs.tsx" isBeta
131
185
  ```
186
+
187
+ ### With drilldown and inline filter
188
+
189
+ ```ts file="MenuFilterDrilldown.tsx"
190
+ ```