1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.PageSection = exports.PageSectionTypes = exports.PageSectionVariants = void 0;
|
4 | const tslib_1 = require("tslib");
|
5 | const React = tslib_1.__importStar(require("react"));
|
6 | const page_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Page/page"));
|
7 | const react_styles_1 = require("@patternfly/react-styles");
|
8 | const util_1 = require("../../helpers/util");
|
9 | var PageSectionVariants;
|
10 | (function (PageSectionVariants) {
|
11 | PageSectionVariants["default"] = "default";
|
12 | PageSectionVariants["light"] = "light";
|
13 | PageSectionVariants["dark"] = "dark";
|
14 | PageSectionVariants["darker"] = "darker";
|
15 | })(PageSectionVariants = exports.PageSectionVariants || (exports.PageSectionVariants = {}));
|
16 | var PageSectionTypes;
|
17 | (function (PageSectionTypes) {
|
18 | PageSectionTypes["default"] = "default";
|
19 | PageSectionTypes["nav"] = "nav";
|
20 | PageSectionTypes["subNav"] = "subnav";
|
21 | PageSectionTypes["breadcrumb"] = "breadcrumb";
|
22 | PageSectionTypes["tabs"] = "tabs";
|
23 | PageSectionTypes["wizard"] = "wizard";
|
24 | })(PageSectionTypes = exports.PageSectionTypes || (exports.PageSectionTypes = {}));
|
25 | const variantType = {
|
26 | [PageSectionTypes.default]: page_1.default.pageMainSection,
|
27 | [PageSectionTypes.nav]: page_1.default.pageMainNav,
|
28 | [PageSectionTypes.subNav]: page_1.default.pageMainSubnav,
|
29 | [PageSectionTypes.breadcrumb]: page_1.default.pageMainBreadcrumb,
|
30 | [PageSectionTypes.tabs]: page_1.default.pageMainTabs,
|
31 | [PageSectionTypes.wizard]: page_1.default.pageMainWizard
|
32 | };
|
33 | const variantStyle = {
|
34 | [PageSectionVariants.default]: '',
|
35 | [PageSectionVariants.light]: page_1.default.modifiers.light,
|
36 | [PageSectionVariants.dark]: page_1.default.modifiers.dark_200,
|
37 | [PageSectionVariants.darker]: page_1.default.modifiers.dark_100
|
38 | };
|
39 | const PageSection = (_a) => {
|
40 | var { className = '', children, variant = 'default', type = 'default', padding, isFilled, isWidthLimited = false, isCenterAligned = false, sticky, hasShadowTop = false, hasShadowBottom = false, hasOverflowScroll = false } = _a, props = tslib_1.__rest(_a, ["className", "children", "variant", "type", "padding", "isFilled", "isWidthLimited", "isCenterAligned", "sticky", "hasShadowTop", "hasShadowBottom", "hasOverflowScroll"]);
|
41 | return (React.createElement("section", Object.assign({}, props, { className: react_styles_1.css(variantType[type], util_1.formatBreakpointMods(padding, page_1.default), variantStyle[variant], isFilled === false && page_1.default.modifiers.noFill, isFilled === true && page_1.default.modifiers.fill, isWidthLimited && page_1.default.modifiers.limitWidth, isWidthLimited && isCenterAligned && type !== PageSectionTypes.subNav && page_1.default.modifiers.alignCenter, sticky === 'top' && page_1.default.modifiers.stickyTop, sticky === 'bottom' && page_1.default.modifiers.stickyBottom, hasShadowTop && page_1.default.modifiers.shadowTop, hasShadowBottom && page_1.default.modifiers.shadowBottom, hasOverflowScroll && page_1.default.modifiers.overflowScroll, className) }, (hasOverflowScroll && { tabIndex: 0 })),
|
42 | isWidthLimited && React.createElement("div", { className: react_styles_1.css(page_1.default.pageMainBody) }, children),
|
43 | !isWidthLimited && children));
|
44 | };
|
45 | exports.PageSection = PageSection;
|
46 | exports.PageSection.displayName = 'PageSection';
|
47 |
|
\ | No newline at end of file |