| 1 |
import { __rest } from "tslib"; |
| 2 |
import { jsx as _jsx } from "react/jsx-runtime"; |
| 3 |
import { useContext, useEffect } from 'react'; |
| 4 |
import { css } from '@patternfly/react-styles'; |
| 5 |
import styles from '@patternfly/react-styles/css/components/Page/page.mjs'; |
| 6 |
import { formatBreakpointMods } from '../../helpers/util'; |
| 7 |
import { PageContext } from './PageContext'; |
| 8 |
export const PageGroup = (_a) => { |
| 9 |
var { className = '', children, stickyOnBreakpoint, stickyBase, isStickyStuck = false, isFilled, hasShadowTop = false, hasShadowBottom = false, hasOverflowScroll = false, 'aria-label': ariaLabel, isPlain = false, isNoPlainOnGlass = false } = _a, props = __rest(_a, ["className", "children", "stickyOnBreakpoint", "stickyBase", "isStickyStuck", "isFilled", "hasShadowTop", "hasShadowBottom", "hasOverflowScroll", 'aria-label', "isPlain", "isNoPlainOnGlass"]); |
| 10 |
const { height, getVerticalBreakpoint } = useContext(PageContext); |
| 11 |
useEffect(() => { |
| 12 |
if (hasOverflowScroll && !ariaLabel) { |
| 13 |
/* eslint-disable no-console */ |
| 14 |
console.warn('PageGroup: An accessible aria-label is required when hasOverflowScroll is set to true.'); |
| 15 |
} |
| 16 |
}, [hasOverflowScroll, ariaLabel]); |
| 17 |
return (_jsx("div", Object.assign({}, props, { className: css(styles.pageMainGroup, formatBreakpointMods(stickyOnBreakpoint, styles, 'sticky-', getVerticalBreakpoint(height), true), stickyBase === 'top' && styles.modifiers.stickyTopBase, stickyBase === 'bottom' && styles.modifiers.stickyBottomBase, isStickyStuck && stickyBase === 'top' && styles.modifiers.stickyTopStuck, isStickyStuck && stickyBase === 'bottom' && styles.modifiers.stickyBottomStuck, isFilled === false && styles.modifiers.noFill, isFilled === true && styles.modifiers.fill, hasShadowTop && styles.modifiers.shadowTop, hasShadowBottom && styles.modifiers.shadowBottom, hasOverflowScroll && styles.modifiers.overflowScroll, isPlain && styles.modifiers.plain, isNoPlainOnGlass && styles.modifiers.noPlainOnGlass, className) }, (hasOverflowScroll && { tabIndex: 0, role: 'region', 'aria-label': ariaLabel }), { children: children }))); |
| 18 |
}; |
| 19 |
PageGroup.displayName = 'PageGroup'; |
| 20 |
//# sourceMappingURL=PageGroup.js.map |