1 | import { __rest } from "tslib";
|
2 | import * as React from 'react';
|
3 | import { css } from '@patternfly/react-styles';
|
4 | import styles from '@patternfly/react-styles/css/components/AppLauncher/app-launcher';
|
5 | import { DropdownItem } from '../Dropdown';
|
6 | import { ApplicationLauncherContent } from './ApplicationLauncherContent';
|
7 | import { ApplicationLauncherContext } from './ApplicationLauncherContext';
|
8 | import { ApplicationLauncherItemContext } from './ApplicationLauncherItemContext';
|
9 | import StarIcon from '@patternfly/react-icons/dist/esm/icons/star-icon';
|
10 | import { getUniqueId } from '../../helpers/util';
|
11 | export const ApplicationLauncherItem = (_a) => {
|
12 | var { className = '', id, children, icon = null, isExternal = false, href, tooltip = null, tooltipProps = null, component = 'a', isFavorite = null, ariaIsFavoriteLabel = 'starred', ariaIsNotFavoriteLabel = 'not starred', customChild, enterTriggersArrowDown = false } = _a, props = __rest(_a, ["className", "id", "children", "icon", "isExternal", "href", "tooltip", "tooltipProps", "component", "isFavorite", "ariaIsFavoriteLabel", "ariaIsNotFavoriteLabel", "customChild", "enterTriggersArrowDown"]);
|
13 | return (React.createElement(ApplicationLauncherItemContext.Provider, { value: { isExternal, icon } },
|
14 | React.createElement(ApplicationLauncherContext.Consumer, null, ({ onFavorite }) => (React.createElement(DropdownItem, Object.assign({ id: id, component: component, href: href || null, className: css(isExternal && styles.modifiers.external, isFavorite !== null && styles.modifiers.link, className), listItemClassName: css(onFavorite && styles.appLauncherMenuWrapper, isFavorite && styles.modifiers.favorite), tooltip: tooltip, tooltipProps: tooltipProps }, (enterTriggersArrowDown === true && { enterTriggersArrowDown }), (customChild && { customChild }), (isFavorite !== null && {
|
15 | additionalChild: (React.createElement("button", { className: css(styles.appLauncherMenuItem, styles.modifiers.action), "aria-label": isFavorite ? ariaIsFavoriteLabel : ariaIsNotFavoriteLabel, onClick: () => {
|
16 | onFavorite((id || getUniqueId('app-launcher-option')).replace('favorite-', ''), isFavorite);
|
17 | } },
|
18 | React.createElement(StarIcon, null)))
|
19 | }), props), children && React.createElement(ApplicationLauncherContent, null, children))))));
|
20 | };
|
21 | ApplicationLauncherItem.displayName = 'ApplicationLauncherItem';
|
22 |
|
\ | No newline at end of file |