@patternfly/react-core 4.192.5 → 4.192.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +38 -25
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Masthead/Masthead.d.ts.map +1 -1
- package/dist/esm/components/Masthead/Masthead.js +6 -2
- package/dist/esm/components/Masthead/Masthead.js.map +1 -1
- package/dist/esm/components/Menu/MenuContent.js +1 -1
- package/dist/esm/components/Menu/MenuContent.js.map +1 -1
- package/dist/esm/components/Nav/Nav.d.ts +4 -2
- package/dist/esm/components/Nav/Nav.d.ts.map +1 -1
- package/dist/esm/components/Nav/Nav.js +2 -1
- package/dist/esm/components/Nav/Nav.js.map +1 -1
- package/dist/esm/components/Nav/NavList.d.ts +2 -8
- package/dist/esm/components/Nav/NavList.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavList.js +4 -7
- package/dist/esm/components/Nav/NavList.js.map +1 -1
- package/dist/esm/components/Page/Page.d.ts +14 -0
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/esm/components/Page/Page.js +31 -16
- package/dist/esm/components/Page/Page.js.map +1 -1
- package/dist/esm/components/Page/PageHeaderToolsGroup.d.ts.map +1 -1
- package/dist/esm/components/Page/PageHeaderToolsGroup.js +3 -1
- package/dist/esm/components/Page/PageHeaderToolsGroup.js.map +1 -1
- package/dist/esm/components/Page/PageHeaderToolsItem.d.ts.map +1 -1
- package/dist/esm/components/Page/PageHeaderToolsItem.js +7 -1
- package/dist/esm/components/Page/PageHeaderToolsItem.js.map +1 -1
- package/dist/esm/components/Page/PageSidebar.d.ts +1 -0
- package/dist/esm/components/Page/PageSidebar.d.ts.map +1 -1
- package/dist/esm/components/Page/PageSidebar.js +3 -2
- package/dist/esm/components/Page/PageSidebar.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +5 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +171 -28
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectMenu.js +2 -1
- package/dist/esm/components/Select/SelectMenu.js.map +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectOption.js +6 -1
- package/dist/esm/components/Select/SelectOption.js.map +1 -1
- package/dist/esm/components/Select/SelectToggle.d.ts +3 -2
- package/dist/esm/components/Select/SelectToggle.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectToggle.js +26 -16
- package/dist/esm/components/Select/SelectToggle.js.map +1 -1
- package/dist/esm/components/Select/selectConstants.d.ts +1 -0
- package/dist/esm/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/esm/components/Select/selectConstants.js +1 -0
- package/dist/esm/components/Select/selectConstants.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.d.ts +4 -6
- package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.js +74 -42
- package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.js +3 -2
- package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.js +3 -2
- package/dist/esm/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.js +2 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarItem.js +3 -2
- package/dist/esm/components/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js +8 -5
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/esm/helpers/util.d.ts +22 -8
- package/dist/esm/helpers/util.d.ts.map +1 -1
- package/dist/esm/helpers/util.js +65 -7
- package/dist/esm/helpers/util.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +38 -25
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/Masthead/Masthead.d.ts.map +1 -1
- package/dist/js/components/Masthead/Masthead.js +6 -2
- package/dist/js/components/Masthead/Masthead.js.map +1 -1
- package/dist/js/components/Menu/MenuContent.js +1 -1
- package/dist/js/components/Menu/MenuContent.js.map +1 -1
- package/dist/js/components/Nav/Nav.d.ts +4 -2
- package/dist/js/components/Nav/Nav.d.ts.map +1 -1
- package/dist/js/components/Nav/Nav.js +3 -2
- package/dist/js/components/Nav/Nav.js.map +1 -1
- package/dist/js/components/Nav/NavList.d.ts +2 -8
- package/dist/js/components/Nav/NavList.d.ts.map +1 -1
- package/dist/js/components/Nav/NavList.js +4 -7
- package/dist/js/components/Nav/NavList.js.map +1 -1
- package/dist/js/components/Page/Page.d.ts +14 -0
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Page/Page.js +34 -19
- package/dist/js/components/Page/Page.js.map +1 -1
- package/dist/js/components/Page/PageHeaderToolsGroup.d.ts.map +1 -1
- package/dist/js/components/Page/PageHeaderToolsGroup.js +3 -1
- package/dist/js/components/Page/PageHeaderToolsGroup.js.map +1 -1
- package/dist/js/components/Page/PageHeaderToolsItem.d.ts.map +1 -1
- package/dist/js/components/Page/PageHeaderToolsItem.js +6 -1
- package/dist/js/components/Page/PageHeaderToolsItem.js.map +1 -1
- package/dist/js/components/Page/PageSidebar.d.ts +1 -0
- package/dist/js/components/Page/PageSidebar.d.ts.map +1 -1
- package/dist/js/components/Page/PageSidebar.js +4 -3
- package/dist/js/components/Page/PageSidebar.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +5 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +170 -27
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/js/components/Select/SelectMenu.js +2 -1
- package/dist/js/components/Select/SelectMenu.js.map +1 -1
- package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/js/components/Select/SelectOption.js +6 -1
- package/dist/js/components/Select/SelectOption.js.map +1 -1
- package/dist/js/components/Select/SelectToggle.d.ts +3 -2
- package/dist/js/components/Select/SelectToggle.d.ts.map +1 -1
- package/dist/js/components/Select/SelectToggle.js +25 -15
- package/dist/js/components/Select/SelectToggle.js.map +1 -1
- package/dist/js/components/Select/selectConstants.d.ts +1 -0
- package/dist/js/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/js/components/Select/selectConstants.js +2 -1
- package/dist/js/components/Select/selectConstants.js.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.d.ts +4 -6
- package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.js +73 -41
- package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.js +3 -2
- package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.js +3 -2
- package/dist/js/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarGroup.js +2 -1
- package/dist/js/components/Toolbar/ToolbarGroup.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarItem.js +3 -2
- package/dist/js/components/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js +7 -4
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/js/helpers/util.d.ts +22 -8
- package/dist/js/helpers/util.d.ts.map +1 -1
- package/dist/js/helpers/util.js +68 -8
- package/dist/js/helpers/util.js.map +1 -1
- package/dist/umd/react-core.css +0 -104
- package/dist/umd/react-core.js +1586 -1319
- package/dist/umd/react-core.min.css +0 -104
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +5 -5
- package/src/components/Alert/examples/AlertAsyncLiveRegion.tsx +1 -1
- package/src/components/ApplicationLauncher/examples/ApplicationLauncher.md +11 -577
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherAlignRight.tsx +32 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherAlignTop.tsx +31 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherBasic.tsx +23 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherCustomIcon.tsx +32 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherDisabled.tsx +25 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherDocumentBody.tsx +31 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherFavoritesAndSearch.tsx +105 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherRouterLink.tsx +50 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherSectionsAndIcons.tsx +47 -0
- package/src/components/ApplicationLauncher/examples/ApplicationLauncherTooltip.tsx +35 -0
- package/src/components/Label/Label.tsx +58 -39
- package/src/components/Label/__tests__/Label.test.tsx +19 -1
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +109 -0
- package/src/components/Label/examples/Label.md +1 -41
- package/src/components/Label/examples/LabelEditable.tsx +57 -0
- package/src/components/Masthead/Masthead.tsx +23 -16
- package/src/components/Masthead/__tests__/__snapshots__/Masthead.test.tsx.snap +11 -11
- package/src/components/Menu/MenuContent.tsx +2 -2
- package/src/components/Menu/examples/Menu.md +7 -7
- package/src/components/Nav/Nav.tsx +4 -2
- package/src/components/Nav/NavList.tsx +4 -7
- package/src/components/Page/Page.tsx +49 -16
- package/src/components/Page/PageHeaderToolsGroup.tsx +16 -5
- package/src/components/Page/PageHeaderToolsItem.tsx +20 -14
- package/src/components/Page/PageSidebar.tsx +3 -3
- package/src/components/Page/__tests__/Generated/__snapshots__/Page.test.tsx.snap +2 -0
- package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +18 -9
- package/src/components/Select/Select.tsx +166 -26
- package/src/components/Select/SelectMenu.tsx +2 -1
- package/src/components/Select/SelectOption.tsx +5 -1
- package/src/components/Select/SelectToggle.tsx +38 -17
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +74 -24
- package/src/components/Select/examples/Select.md +5 -1
- package/src/components/Select/selectConstants.tsx +2 -0
- package/src/components/TimePicker/TimePicker.tsx +112 -124
- package/src/components/TimePicker/examples/TimePicker.md +16 -10
- package/src/components/Toolbar/Toolbar.tsx +44 -39
- package/src/components/Toolbar/ToolbarContent.tsx +45 -40
- package/src/components/Toolbar/ToolbarGroup.tsx +19 -14
- package/src/components/Toolbar/ToolbarItem.tsx +30 -19
- package/src/components/Toolbar/ToolbarToggleGroup.tsx +60 -53
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/Toolbar.test.tsx.snap +3 -43
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarContent.test.tsx.snap +3 -7
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarItem.test.tsx.snap +3 -8
- package/src/demos/ComposableMenu/ComposableMenu.md +88 -0
- package/src/demos/ComposableMenu/examples/ComposableActionsMenu.tsx +122 -0
- package/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx +282 -0
- package/src/demos/ComposableMenu/examples/ComposableContextSelector.tsx +202 -0
- package/src/demos/ComposableMenu/examples/ComposableDrilldownMenu.tsx +246 -0
- package/src/demos/ComposableMenu/examples/ComposableDropdwnVariants.tsx +235 -0
- package/src/demos/ComposableMenu/examples/ComposableFlyout.tsx +103 -0
- package/src/demos/ComposableMenu/examples/ComposableOptionsMenuVariants.tsx +94 -0
- package/src/demos/ComposableMenu/examples/ComposableSimpleDropdown.tsx +70 -0
- package/src/demos/ComposableMenu/examples/ComposableSimpleSelect.tsx +74 -0
- package/src/demos/ComposableMenu/examples/ComposableTreeViewMenu.tsx +240 -0
- package/src/demos/ComposableMenu/examples/avatarImg.svg +18 -0
- package/src/demos/ComposableMenu/examples/pf-logo-small.svg +23 -0
- package/src/demos/Page/Page.md +92 -43
- package/src/helpers/util.ts +74 -12
- package/src/demos/ComposableMenu.md +0 -1443
- package/src/demos/composable-menu.css +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.192.
|
|
3
|
+
"version": "4.192.9",
|
|
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",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.43.
|
|
38
|
-
"@patternfly/react-styles": "^4.42.
|
|
39
|
-
"@patternfly/react-tokens": "^4.44.
|
|
37
|
+
"@patternfly/react-icons": "^4.43.9",
|
|
38
|
+
"@patternfly/react-styles": "^4.42.9",
|
|
39
|
+
"@patternfly/react-tokens": "^4.44.9",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "ef03957eef7673a3fbecd704a5a0c88040bd5313"
|
|
64
64
|
}
|
|
@@ -9,7 +9,7 @@ interface AlertInfo {
|
|
|
9
9
|
|
|
10
10
|
export const AsyncLiveRegionAlert: React.FunctionComponent = () => {
|
|
11
11
|
const [alerts, setAlerts] = React.useState<AlertInfo[]>([]);
|
|
12
|
-
const [isActive, setIsActive] = React.useState
|
|
12
|
+
const [isActive, setIsActive] = React.useState(false);
|
|
13
13
|
const getUniqueId: () => number = () => new Date().getTime();
|
|
14
14
|
|
|
15
15
|
const addAlert = (alertInfo: AlertInfo) => {
|
|
@@ -8,7 +8,7 @@ ouia: true
|
|
|
8
8
|
|
|
9
9
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
10
10
|
import { Link } from '@reach/router';
|
|
11
|
-
import
|
|
11
|
+
import pfLogoSm from './pf-logo-small.svg';
|
|
12
12
|
|
|
13
13
|
Note: Application launcher is built on Dropdown, for extended API go to [Dropdown](/documentation/react/components/dropdown) documentation.
|
|
14
14
|
To add a tooltip, use the `tooltip` prop and optionally add more tooltip props by using `tooltipProps`. For more tooltip information go to [Tooltip](/documentation/react/components/tooltip).
|
|
@@ -17,616 +17,50 @@ To add a tooltip, use the `tooltip` prop and optionally add more tooltip props b
|
|
|
17
17
|
|
|
18
18
|
### Basic
|
|
19
19
|
|
|
20
|
-
```
|
|
21
|
-
import React from 'react';
|
|
22
|
-
import { ApplicationLauncher, ApplicationLauncherItem } from '@patternfly/react-core';
|
|
23
|
-
|
|
24
|
-
class SimpleApplicationLauncher extends React.Component {
|
|
25
|
-
constructor(props) {
|
|
26
|
-
super(props);
|
|
27
|
-
this.state = {
|
|
28
|
-
isOpen: false
|
|
29
|
-
};
|
|
30
|
-
this.onToggle = isOpen => {
|
|
31
|
-
this.setState({
|
|
32
|
-
isOpen
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
this.onSelect = event => {
|
|
36
|
-
this.setState({
|
|
37
|
-
isOpen: !this.state.isOpen
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
render() {
|
|
43
|
-
const { isOpen } = this.state;
|
|
44
|
-
const appLauncherItems = [
|
|
45
|
-
<ApplicationLauncherItem key="application_1a" href="#">
|
|
46
|
-
Application 1 (anchor link)
|
|
47
|
-
</ApplicationLauncherItem>,
|
|
48
|
-
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
49
|
-
Application 2 (button with onClick)
|
|
50
|
-
</ApplicationLauncherItem>,
|
|
51
|
-
<ApplicationLauncherItem key="disabled_application_4a" isDisabled>
|
|
52
|
-
Unavailable application
|
|
53
|
-
</ApplicationLauncherItem>
|
|
54
|
-
];
|
|
55
|
-
return (
|
|
56
|
-
<ApplicationLauncher onSelect={this.onSelect} onToggle={this.onToggle} isOpen={isOpen} items={appLauncherItems} />
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
20
|
+
```ts file="./ApplicationLauncherBasic.tsx"
|
|
60
21
|
```
|
|
61
22
|
|
|
62
23
|
### Router link
|
|
63
24
|
|
|
64
|
-
```
|
|
65
|
-
import React from 'react';
|
|
66
|
-
import { Link } from '@reach/router';
|
|
67
|
-
import { ApplicationLauncher, ApplicationLauncherItem, ApplicationLauncherContent, Text } from '@patternfly/react-core';
|
|
68
|
-
|
|
69
|
-
class SimpleApplicationLauncher extends React.Component {
|
|
70
|
-
constructor(props) {
|
|
71
|
-
super(props);
|
|
72
|
-
this.state = {
|
|
73
|
-
isOpen: false
|
|
74
|
-
};
|
|
75
|
-
this.onToggle = isOpen => {
|
|
76
|
-
this.setState({
|
|
77
|
-
isOpen
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
this.onSelect = event => {
|
|
81
|
-
this.setState({
|
|
82
|
-
isOpen: !this.state.isOpen
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
render() {
|
|
88
|
-
const { isOpen } = this.state;
|
|
89
|
-
const icon = <img src={pfIcon} />;
|
|
90
|
-
const exampleStyle = {
|
|
91
|
-
color: 'var(--pf-c-app-launcher__menu-item--Color)',
|
|
92
|
-
textDecoration: 'none'
|
|
93
|
-
};
|
|
94
|
-
const appLauncherItems = [
|
|
95
|
-
<ApplicationLauncherItem
|
|
96
|
-
key="router1"
|
|
97
|
-
component={
|
|
98
|
-
<Link to="/" style={exampleStyle}>
|
|
99
|
-
@reach/router Link
|
|
100
|
-
</Link>
|
|
101
|
-
}
|
|
102
|
-
/>,
|
|
103
|
-
<ApplicationLauncherItem
|
|
104
|
-
key="router2"
|
|
105
|
-
isExternal
|
|
106
|
-
icon={icon}
|
|
107
|
-
component={
|
|
108
|
-
<Link to="/" style={exampleStyle}>
|
|
109
|
-
<ApplicationLauncherContent>@reach/router Link with icon</ApplicationLauncherContent>
|
|
110
|
-
</Link>
|
|
111
|
-
}
|
|
112
|
-
/>,
|
|
113
|
-
<ApplicationLauncherItem key="application_1a" href="#">
|
|
114
|
-
Application 1 (anchor link)
|
|
115
|
-
</ApplicationLauncherItem>,
|
|
116
|
-
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
117
|
-
Application 2 (button with onClick)
|
|
118
|
-
</ApplicationLauncherItem>,
|
|
119
|
-
<ApplicationLauncherItem key="disabled_application_4a" isDisabled>
|
|
120
|
-
Unavailable application
|
|
121
|
-
</ApplicationLauncherItem>
|
|
122
|
-
];
|
|
123
|
-
return (
|
|
124
|
-
<ApplicationLauncher onSelect={this.onSelect} onToggle={this.onToggle} isOpen={isOpen} items={appLauncherItems} />
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
25
|
+
```ts file="./ApplicationLauncherRouterLink.tsx"
|
|
128
26
|
```
|
|
129
27
|
|
|
130
28
|
### Disabled
|
|
131
29
|
|
|
132
|
-
```
|
|
133
|
-
import React from 'react';
|
|
134
|
-
import { ApplicationLauncher, ApplicationLauncherItem } from '@patternfly/react-core';
|
|
135
|
-
|
|
136
|
-
class SimpleApplicationLauncher extends React.Component {
|
|
137
|
-
constructor(props) {
|
|
138
|
-
super(props);
|
|
139
|
-
this.state = {
|
|
140
|
-
isOpen: false
|
|
141
|
-
};
|
|
142
|
-
this.onToggle = isOpen => {
|
|
143
|
-
this.setState({
|
|
144
|
-
isOpen
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
this.onSelect = event => {
|
|
148
|
-
this.setState({
|
|
149
|
-
isOpen: !this.state.isOpen
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
render() {
|
|
155
|
-
const { isOpen } = this.state;
|
|
156
|
-
const appLauncherItems = [
|
|
157
|
-
<ApplicationLauncherItem key="application_1a" href="#">
|
|
158
|
-
Application 1 (anchor link)
|
|
159
|
-
</ApplicationLauncherItem>,
|
|
160
|
-
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
161
|
-
Application 2 (button with onClick)
|
|
162
|
-
</ApplicationLauncherItem>,
|
|
163
|
-
<ApplicationLauncherItem key="disabled_application_4a" isDisabled>
|
|
164
|
-
Unavailable application
|
|
165
|
-
</ApplicationLauncherItem>
|
|
166
|
-
];
|
|
167
|
-
return (
|
|
168
|
-
<ApplicationLauncher
|
|
169
|
-
onSelect={this.onSelect}
|
|
170
|
-
onToggle={this.onToggle}
|
|
171
|
-
isOpen={isOpen}
|
|
172
|
-
items={appLauncherItems}
|
|
173
|
-
isDisabled
|
|
174
|
-
/>
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
30
|
+
```ts file="./ApplicationLauncherDisabled.tsx"
|
|
178
31
|
```
|
|
179
32
|
|
|
180
33
|
### Aligned right
|
|
181
34
|
|
|
182
|
-
```
|
|
183
|
-
import React from 'react';
|
|
184
|
-
import { ApplicationLauncher, ApplicationLauncherItem } from '@patternfly/react-core';
|
|
185
|
-
import { DropdownPosition } from '../Dropdown';
|
|
186
|
-
|
|
187
|
-
class SimpleApplicationLauncher extends React.Component {
|
|
188
|
-
constructor(props) {
|
|
189
|
-
super(props);
|
|
190
|
-
this.state = {
|
|
191
|
-
isOpen: false
|
|
192
|
-
};
|
|
193
|
-
this.onToggle = isOpen => {
|
|
194
|
-
this.setState({
|
|
195
|
-
isOpen
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
this.onSelect = event => {
|
|
199
|
-
this.setState({
|
|
200
|
-
isOpen: !this.state.isOpen
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
render() {
|
|
206
|
-
const { isOpen } = this.state;
|
|
207
|
-
const appLauncherItems = [
|
|
208
|
-
<ApplicationLauncherItem key="application_1a" href="#">
|
|
209
|
-
Application 1 (anchor link)
|
|
210
|
-
</ApplicationLauncherItem>,
|
|
211
|
-
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
212
|
-
Application 2 (button with onClick)
|
|
213
|
-
</ApplicationLauncherItem>,
|
|
214
|
-
<ApplicationLauncherItem key="disabled_application_4a" isDisabled>
|
|
215
|
-
Unavailable application
|
|
216
|
-
</ApplicationLauncherItem>
|
|
217
|
-
];
|
|
218
|
-
const style = { marginLeft: 'calc(100% - 46px)' };
|
|
219
|
-
return (
|
|
220
|
-
<ApplicationLauncher
|
|
221
|
-
onSelect={this.onSelect}
|
|
222
|
-
onToggle={this.onToggle}
|
|
223
|
-
isOpen={isOpen}
|
|
224
|
-
items={appLauncherItems}
|
|
225
|
-
position={DropdownPosition.right}
|
|
226
|
-
style={style}
|
|
227
|
-
/>
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
35
|
+
```ts file="./ApplicationLauncherAlignRight.tsx"
|
|
231
36
|
```
|
|
232
37
|
|
|
233
38
|
### Aligned top
|
|
234
39
|
|
|
235
|
-
```
|
|
236
|
-
import React from 'react';
|
|
237
|
-
import { ApplicationLauncher, ApplicationLauncherItem } from '@patternfly/react-core';
|
|
238
|
-
import { DropdownDirection } from '../Dropdown';
|
|
239
|
-
|
|
240
|
-
class SimpleApplicationLauncher extends React.Component {
|
|
241
|
-
constructor(props) {
|
|
242
|
-
super(props);
|
|
243
|
-
this.state = {
|
|
244
|
-
isOpen: false
|
|
245
|
-
};
|
|
246
|
-
this.onToggle = isOpen => {
|
|
247
|
-
this.setState({
|
|
248
|
-
isOpen
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
this.onSelect = event => {
|
|
252
|
-
this.setState({
|
|
253
|
-
isOpen: !this.state.isOpen
|
|
254
|
-
});
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
render() {
|
|
259
|
-
const { isOpen } = this.state;
|
|
260
|
-
const appLauncherItems = [
|
|
261
|
-
<ApplicationLauncherItem key="application_1a" href="#">
|
|
262
|
-
Application 1 (anchor link)
|
|
263
|
-
</ApplicationLauncherItem>,
|
|
264
|
-
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
265
|
-
Application 2 (button with onClick)
|
|
266
|
-
</ApplicationLauncherItem>,
|
|
267
|
-
<ApplicationLauncherItem key="disabled_application_4a" isDisabled>
|
|
268
|
-
Unavailable application
|
|
269
|
-
</ApplicationLauncherItem>
|
|
270
|
-
];
|
|
271
|
-
return (
|
|
272
|
-
<ApplicationLauncher
|
|
273
|
-
onSelect={this.onSelect}
|
|
274
|
-
onToggle={this.onToggle}
|
|
275
|
-
isOpen={isOpen}
|
|
276
|
-
items={appLauncherItems}
|
|
277
|
-
direction={DropdownDirection.up}
|
|
278
|
-
/>
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
40
|
+
```ts file="./ApplicationLauncherAlignTop.tsx"
|
|
282
41
|
```
|
|
283
42
|
|
|
284
43
|
### With tooltip
|
|
285
44
|
|
|
286
|
-
```
|
|
287
|
-
import React from 'react';
|
|
288
|
-
import { ApplicationLauncher, ApplicationLauncherItem } from '@patternfly/react-core';
|
|
289
|
-
|
|
290
|
-
class TooltipApplicationLauncher extends React.Component {
|
|
291
|
-
constructor(props) {
|
|
292
|
-
super(props);
|
|
293
|
-
this.state = {
|
|
294
|
-
isOpen: false
|
|
295
|
-
};
|
|
296
|
-
this.onToggle = isOpen => {
|
|
297
|
-
this.setState({
|
|
298
|
-
isOpen
|
|
299
|
-
});
|
|
300
|
-
};
|
|
301
|
-
this.onSelect = event => {
|
|
302
|
-
this.setState({
|
|
303
|
-
isOpen: !this.state.isOpen
|
|
304
|
-
});
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
render() {
|
|
309
|
-
const { isOpen } = this.state;
|
|
310
|
-
const appLauncherItems = [
|
|
311
|
-
<ApplicationLauncherItem key="application_1b" href="#" tooltip={<div>Launch Application 1</div>}>
|
|
312
|
-
Application 1 (anchor link)
|
|
313
|
-
</ApplicationLauncherItem>,
|
|
314
|
-
<ApplicationLauncherItem
|
|
315
|
-
key="application_2b"
|
|
316
|
-
component="button"
|
|
317
|
-
tooltip={<div>Launch Application 2</div>}
|
|
318
|
-
tooltipProps={{ position: 'right' }}
|
|
319
|
-
onClick={() => alert('Clicked item 2')}
|
|
320
|
-
>
|
|
321
|
-
Application 2 (onClick)
|
|
322
|
-
</ApplicationLauncherItem>,
|
|
323
|
-
<ApplicationLauncherItem
|
|
324
|
-
key="application_3b"
|
|
325
|
-
component="button"
|
|
326
|
-
tooltip={<div>Launch Application 3</div>}
|
|
327
|
-
tooltipProps={{ position: 'bottom' }}
|
|
328
|
-
onClick={() => alert('Clicked item 3')}
|
|
329
|
-
>
|
|
330
|
-
Application 3 (onClick)
|
|
331
|
-
</ApplicationLauncherItem>
|
|
332
|
-
];
|
|
333
|
-
return (
|
|
334
|
-
<ApplicationLauncher onSelect={this.onSelect} onToggle={this.onToggle} isOpen={isOpen} items={appLauncherItems} />
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
45
|
+
```ts file="./ApplicationLauncherTooltip.tsx"
|
|
338
46
|
```
|
|
339
47
|
|
|
340
48
|
### With sections and icons
|
|
341
49
|
|
|
342
|
-
```
|
|
343
|
-
import React from 'react';
|
|
344
|
-
import {
|
|
345
|
-
ApplicationLauncher,
|
|
346
|
-
ApplicationLauncherItem,
|
|
347
|
-
ApplicationLauncherGroup,
|
|
348
|
-
ApplicationLauncherSeparator
|
|
349
|
-
} from '@patternfly/react-core';
|
|
350
|
-
import pfIcon from './examples/pf-logo-small.svg';
|
|
351
|
-
|
|
352
|
-
class ApplicationLauncherSections extends React.Component {
|
|
353
|
-
constructor(props) {
|
|
354
|
-
super(props);
|
|
355
|
-
this.state = {
|
|
356
|
-
isOpen: false
|
|
357
|
-
};
|
|
358
|
-
this.onToggle = isOpen => {
|
|
359
|
-
this.setState({
|
|
360
|
-
isOpen
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
this.onSelect = event => {
|
|
364
|
-
this.setState({
|
|
365
|
-
isOpen: !this.state.isOpen
|
|
366
|
-
});
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
render() {
|
|
371
|
-
const { isOpen } = this.state;
|
|
372
|
-
const icon = <img src={pfIcon} />;
|
|
373
|
-
const appLauncherItems = [
|
|
374
|
-
<ApplicationLauncherGroup key="group 1c">
|
|
375
|
-
<ApplicationLauncherItem key="group 1a" icon={icon}>
|
|
376
|
-
Item without group title
|
|
377
|
-
</ApplicationLauncherItem>
|
|
378
|
-
<ApplicationLauncherSeparator key="separator" />
|
|
379
|
-
</ApplicationLauncherGroup>,
|
|
380
|
-
<ApplicationLauncherGroup label="Group 2" key="group 2c">
|
|
381
|
-
<ApplicationLauncherItem key="group 2a" isExternal icon={icon} component="button">
|
|
382
|
-
Group 2 button
|
|
383
|
-
</ApplicationLauncherItem>
|
|
384
|
-
<ApplicationLauncherItem key="group 2b" isExternal href="#" icon={icon}>
|
|
385
|
-
Group 2 anchor link
|
|
386
|
-
</ApplicationLauncherItem>
|
|
387
|
-
<ApplicationLauncherSeparator key="separator" />
|
|
388
|
-
</ApplicationLauncherGroup>,
|
|
389
|
-
<ApplicationLauncherGroup label="Group 3" key="group 3c">
|
|
390
|
-
<ApplicationLauncherItem key="group 3a" isExternal icon={icon} component="button">
|
|
391
|
-
Group 3 button
|
|
392
|
-
</ApplicationLauncherItem>
|
|
393
|
-
<ApplicationLauncherItem key="group 3b" isExternal href="#" icon={icon}>
|
|
394
|
-
Group 3 anchor link
|
|
395
|
-
</ApplicationLauncherItem>
|
|
396
|
-
</ApplicationLauncherGroup>
|
|
397
|
-
];
|
|
398
|
-
return (
|
|
399
|
-
<ApplicationLauncher
|
|
400
|
-
onSelect={this.onSelect}
|
|
401
|
-
onToggle={this.onToggle}
|
|
402
|
-
isOpen={isOpen}
|
|
403
|
-
items={appLauncherItems}
|
|
404
|
-
isGrouped
|
|
405
|
-
/>
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
50
|
+
```ts file="./ApplicationLauncherSectionsAndIcons.tsx"
|
|
409
51
|
```
|
|
410
52
|
|
|
411
53
|
### With favorites and search
|
|
412
54
|
|
|
413
|
-
```
|
|
414
|
-
import React from 'react';
|
|
415
|
-
import {
|
|
416
|
-
ApplicationLauncher,
|
|
417
|
-
ApplicationLauncherItem,
|
|
418
|
-
ApplicationLauncherGroup,
|
|
419
|
-
ApplicationLauncherSeparator
|
|
420
|
-
} from '@patternfly/react-core';
|
|
421
|
-
import pfIcon from './examples/pf-logo-small.svg';
|
|
422
|
-
|
|
423
|
-
class ApplicationLauncherFavorites extends React.Component {
|
|
424
|
-
constructor(props) {
|
|
425
|
-
super(props);
|
|
426
|
-
this.state = {
|
|
427
|
-
isOpen: false,
|
|
428
|
-
favorites: [],
|
|
429
|
-
filteredItems: null
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
const icon = <img src={pfIcon} />;
|
|
433
|
-
this.appLauncherItems = [
|
|
434
|
-
<ApplicationLauncherGroup key="group 1c">
|
|
435
|
-
<ApplicationLauncherItem key="group 1a" id="item-1" icon={icon}>
|
|
436
|
-
Item without group title
|
|
437
|
-
</ApplicationLauncherItem>
|
|
438
|
-
<ApplicationLauncherSeparator key="separator" />
|
|
439
|
-
</ApplicationLauncherGroup>,
|
|
440
|
-
<ApplicationLauncherGroup label="Group 2" key="group 2c">
|
|
441
|
-
<ApplicationLauncherItem key="group 2a" id="item-2" isExternal icon={icon} component="button">
|
|
442
|
-
Group 2 button
|
|
443
|
-
</ApplicationLauncherItem>
|
|
444
|
-
<ApplicationLauncherItem key="group 2b" id="item-3" isExternal href="#" icon={icon}>
|
|
445
|
-
Group 2 anchor link
|
|
446
|
-
</ApplicationLauncherItem>
|
|
447
|
-
<ApplicationLauncherSeparator key="separator" />
|
|
448
|
-
</ApplicationLauncherGroup>,
|
|
449
|
-
<ApplicationLauncherGroup label="Group 3" key="group 3c">
|
|
450
|
-
<ApplicationLauncherItem key="group 3a" id="item-4" isExternal icon={icon} component="button">
|
|
451
|
-
Group 3 button
|
|
452
|
-
</ApplicationLauncherItem>
|
|
453
|
-
<ApplicationLauncherItem key="group 3b" id="item-5" isExternal href="#" icon={icon}>
|
|
454
|
-
Group 3 anchor link
|
|
455
|
-
</ApplicationLauncherItem>
|
|
456
|
-
</ApplicationLauncherGroup>
|
|
457
|
-
];
|
|
458
|
-
|
|
459
|
-
this.onToggle = isOpen => {
|
|
460
|
-
this.setState({
|
|
461
|
-
isOpen
|
|
462
|
-
});
|
|
463
|
-
};
|
|
464
|
-
this.onSelect = event => {
|
|
465
|
-
this.setState({
|
|
466
|
-
isOpen: !this.state.isOpen
|
|
467
|
-
});
|
|
468
|
-
};
|
|
469
|
-
this.onFavorite = (itemId, isFavorite) => {
|
|
470
|
-
if (isFavorite) {
|
|
471
|
-
this.setState({
|
|
472
|
-
favorites: this.state.favorites.filter(id => id !== itemId)
|
|
473
|
-
});
|
|
474
|
-
} else
|
|
475
|
-
this.setState({
|
|
476
|
-
favorites: [...this.state.favorites, itemId]
|
|
477
|
-
});
|
|
478
|
-
};
|
|
479
|
-
this.onSearch = textInput => {
|
|
480
|
-
if (textInput === '') {
|
|
481
|
-
this.setState({
|
|
482
|
-
filteredItems: null
|
|
483
|
-
});
|
|
484
|
-
} else {
|
|
485
|
-
let filteredGroups = this.appLauncherItems
|
|
486
|
-
.map(group => {
|
|
487
|
-
let filteredGroup = React.cloneElement(group, {
|
|
488
|
-
children: group.props.children.filter(item => {
|
|
489
|
-
if (item.type === ApplicationLauncherSeparator) return item;
|
|
490
|
-
return item.props.children.toLowerCase().includes(textInput.toLowerCase());
|
|
491
|
-
})
|
|
492
|
-
});
|
|
493
|
-
if (
|
|
494
|
-
filteredGroup.props.children.length > 0 &&
|
|
495
|
-
filteredGroup.props.children[0].type !== ApplicationLauncherSeparator
|
|
496
|
-
)
|
|
497
|
-
return filteredGroup;
|
|
498
|
-
})
|
|
499
|
-
.filter(newGroup => newGroup);
|
|
500
|
-
|
|
501
|
-
if (filteredGroups.length > 0) {
|
|
502
|
-
let lastGroup = filteredGroups.pop();
|
|
503
|
-
lastGroup = React.cloneElement(lastGroup, {
|
|
504
|
-
children: lastGroup.props.children.filter(item => item.type !== ApplicationLauncherSeparator)
|
|
505
|
-
});
|
|
506
|
-
filteredGroups.push(lastGroup);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
this.setState({
|
|
510
|
-
filteredItems: filteredGroups
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
render() {
|
|
517
|
-
const { isOpen, favorites, filteredItems } = this.state;
|
|
518
|
-
return (
|
|
519
|
-
<ApplicationLauncher
|
|
520
|
-
onToggle={this.onToggle}
|
|
521
|
-
onFavorite={this.onFavorite}
|
|
522
|
-
onSearch={this.onSearch}
|
|
523
|
-
isOpen={isOpen}
|
|
524
|
-
items={filteredItems || this.appLauncherItems}
|
|
525
|
-
favorites={favorites}
|
|
526
|
-
isGrouped
|
|
527
|
-
/>
|
|
528
|
-
);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
55
|
+
```ts file="./ApplicationLauncherFavoritesAndSearch.tsx"
|
|
531
56
|
```
|
|
532
57
|
|
|
533
58
|
### With custom icon
|
|
534
59
|
|
|
535
|
-
```
|
|
536
|
-
import React from 'react';
|
|
537
|
-
import { ApplicationLauncher, ApplicationLauncherItem } from '@patternfly/react-core';
|
|
538
|
-
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
539
|
-
|
|
540
|
-
class ApplicationLauncheIcon extends React.Component {
|
|
541
|
-
constructor(props) {
|
|
542
|
-
super(props);
|
|
543
|
-
this.state = {
|
|
544
|
-
isOpen: false
|
|
545
|
-
};
|
|
546
|
-
this.onToggle = isOpen => {
|
|
547
|
-
this.setState({
|
|
548
|
-
isOpen
|
|
549
|
-
});
|
|
550
|
-
};
|
|
551
|
-
this.onSelect = event => {
|
|
552
|
-
this.setState({
|
|
553
|
-
isOpen: !this.state.isOpen
|
|
554
|
-
});
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
render() {
|
|
559
|
-
const { isOpen } = this.state;
|
|
560
|
-
const appLauncherItems = [
|
|
561
|
-
<ApplicationLauncherItem key="application_1a" href="#">
|
|
562
|
-
Application 1 (anchor link)
|
|
563
|
-
</ApplicationLauncherItem>,
|
|
564
|
-
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
565
|
-
Application 2 (button with onClick)
|
|
566
|
-
</ApplicationLauncherItem>,
|
|
567
|
-
<ApplicationLauncherItem key="disabled_application_4a" isDisabled>
|
|
568
|
-
Unavailable application
|
|
569
|
-
</ApplicationLauncherItem>
|
|
570
|
-
];
|
|
571
|
-
return (
|
|
572
|
-
<ApplicationLauncher
|
|
573
|
-
onSelect={this.onSelect}
|
|
574
|
-
onToggle={this.onToggle}
|
|
575
|
-
isOpen={isOpen}
|
|
576
|
-
items={appLauncherItems}
|
|
577
|
-
toggleIcon={<HelpIcon />}
|
|
578
|
-
/>
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
60
|
+
```ts file="./ApplicationLauncherCustomIcon.tsx"
|
|
582
61
|
```
|
|
583
62
|
|
|
584
63
|
### Basic with menu appended to document body
|
|
585
64
|
|
|
586
|
-
```
|
|
587
|
-
import React from 'react';
|
|
588
|
-
import { ApplicationLauncher, ApplicationLauncherItem } from '@patternfly/react-core';
|
|
589
|
-
|
|
590
|
-
class ApplicationLauncherDocumentBody extends React.Component {
|
|
591
|
-
constructor(props) {
|
|
592
|
-
super(props);
|
|
593
|
-
this.state = {
|
|
594
|
-
isOpen: false
|
|
595
|
-
};
|
|
596
|
-
this.onToggle = isOpen => {
|
|
597
|
-
this.setState({
|
|
598
|
-
isOpen
|
|
599
|
-
});
|
|
600
|
-
};
|
|
601
|
-
this.onSelect = event => {
|
|
602
|
-
this.setState({
|
|
603
|
-
isOpen: !this.state.isOpen
|
|
604
|
-
});
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
render() {
|
|
609
|
-
const { isOpen } = this.state;
|
|
610
|
-
const appLauncherItems = [
|
|
611
|
-
<ApplicationLauncherItem key="application_1a" href="#">
|
|
612
|
-
Application 1 (anchor link)
|
|
613
|
-
</ApplicationLauncherItem>,
|
|
614
|
-
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
615
|
-
Application 2 (button with onClick)
|
|
616
|
-
</ApplicationLauncherItem>,
|
|
617
|
-
<ApplicationLauncherItem key="disabled_application_4a" isDisabled>
|
|
618
|
-
Unavailable application
|
|
619
|
-
</ApplicationLauncherItem>
|
|
620
|
-
];
|
|
621
|
-
return (
|
|
622
|
-
<ApplicationLauncher
|
|
623
|
-
menuAppendTo={() => document.body}
|
|
624
|
-
onSelect={this.onSelect}
|
|
625
|
-
onToggle={this.onToggle}
|
|
626
|
-
isOpen={isOpen}
|
|
627
|
-
items={appLauncherItems}
|
|
628
|
-
/>
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
65
|
+
```ts file="./ApplicationLauncherDocumentBody.tsx"
|
|
632
66
|
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ApplicationLauncher, ApplicationLauncherItem, DropdownPosition } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
const appLauncherItems: React.ReactElement[] = [
|
|
5
|
+
<ApplicationLauncherItem key="application_1a" href="#">
|
|
6
|
+
Application 1 (anchor link)
|
|
7
|
+
</ApplicationLauncherItem>,
|
|
8
|
+
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
9
|
+
Application 2 (button with onClick)
|
|
10
|
+
</ApplicationLauncherItem>,
|
|
11
|
+
<ApplicationLauncherItem key="disabled_application_4a" isDisabled>
|
|
12
|
+
Unavailable application
|
|
13
|
+
</ApplicationLauncherItem>
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const ApplicationLauncherAlignRight: React.FunctionComponent = () => {
|
|
17
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
18
|
+
|
|
19
|
+
const onToggle = (isOpen: boolean) => setIsOpen(isOpen);
|
|
20
|
+
const onSelect = (_event: any) => setIsOpen(prevIsOpen => !prevIsOpen);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<ApplicationLauncher
|
|
24
|
+
onSelect={onSelect}
|
|
25
|
+
onToggle={onToggle}
|
|
26
|
+
isOpen={isOpen}
|
|
27
|
+
items={appLauncherItems}
|
|
28
|
+
position={DropdownPosition.right}
|
|
29
|
+
style={{ marginLeft: 'calc(100% - 46px)' }}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
};
|