Debian Codegraph @

node/@patternfly/react-core/dist/esm/components/Page/PageBreadcrumb.js

raw
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 import { PageBody } from './PageBody';
9 export const PageBreadcrumb = (_a) => {
10 var { className = '', children, isWidthLimited, stickyOnBreakpoint, hasShadowTop = false, hasShadowBottom = false, hasOverflowScroll = false, 'aria-label': ariaLabel, hasBodyWrapper = true } = _a, props = __rest(_a, ["className", "children", "isWidthLimited", "stickyOnBreakpoint", "hasShadowTop", "hasShadowBottom", "hasOverflowScroll", 'aria-label', "hasBodyWrapper"]);
11 const { height, getVerticalBreakpoint } = useContext(PageContext);
12 useEffect(() => {
13 if (hasOverflowScroll && !ariaLabel) {
14 /* eslint-disable no-console */
15 console.warn('PageBreadcrumb: An accessible aria-label is required when hasOverflowScroll is set to true.');
16 }
17 }, [hasOverflowScroll, ariaLabel]);
18 return (_jsx("section", Object.assign({ className: css(styles.pageMainBreadcrumb, formatBreakpointMods(stickyOnBreakpoint, styles, 'sticky-', getVerticalBreakpoint(height), true), isWidthLimited && styles.modifiers.limitWidth, hasShadowTop && styles.modifiers.shadowTop, hasShadowBottom && styles.modifiers.shadowBottom, hasOverflowScroll && styles.modifiers.overflowScroll, className) }, (hasOverflowScroll && { tabIndex: 0 }), { "aria-label": ariaLabel }, props, { children: hasBodyWrapper ? _jsx(PageBody, { children: children }) : children })));
19 };
20 PageBreadcrumb.displayName = 'PageBreadcrumb';
21 //# sourceMappingURL=PageBreadcrumb.js.map