| 1 |
import { __rest } from "tslib"; |
| 2 |
import { jsx as _jsx } from "react/jsx-runtime"; |
| 3 |
import { useContext } from 'react'; |
| 4 |
import { Button, ButtonVariant } from '../Button'; |
| 5 |
import { AlertContext } from './AlertContext'; |
| 6 |
import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon'; |
| 7 |
import { css } from '@patternfly/react-styles'; |
| 8 |
import styles from '@patternfly/react-styles/css/components/Alert/alert.mjs'; |
| 9 |
export const AlertToggleExpandButton = (_a) => { |
| 10 |
var { 'aria-label': ariaLabel = '', variantLabel, onToggleExpand, isExpanded = false } = _a, props = __rest(_a, ['aria-label', "variantLabel", "onToggleExpand", "isExpanded"]); |
| 11 |
const { title, variantLabel: alertVariantLabel } = useContext(AlertContext); |
| 12 |
return (_jsx(Button, Object.assign({ variant: ButtonVariant.plain, onClick: onToggleExpand, "aria-expanded": isExpanded, "aria-label": ariaLabel === '' ? `Toggle ${variantLabel || alertVariantLabel} alert: ${title}` : ariaLabel }, props, { icon: _jsx("span", { className: css(styles.alertToggleIcon), children: _jsx(RhMicronsCaretDownIcon, {}) }) }))); |
| 13 |
}; |
| 14 |
AlertToggleExpandButton.displayName = 'AlertToggleExpandButton'; |
| 15 |
//# sourceMappingURL=AlertToggleExpandButton.js.map |