Debian Codegraph @

node/@patternfly/react-core/dist/js/components/Drawer/Drawer.js

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.Drawer = exports.DrawerContext = exports.DrawerColorVariant = void 0;
4 const tslib_1 = require("tslib");
5 const jsx_runtime_1 = require("react/jsx-runtime");
6 const react_1 = require("react");
7 const drawer_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Drawer/drawer"));
8 const react_styles_1 = require("@patternfly/react-styles");
9 var DrawerColorVariant;
10 (function (DrawerColorVariant) {
11 DrawerColorVariant["default"] = "default";
12 DrawerColorVariant["secondary"] = "secondary";
13 /**
14 * @deprecated `DrawerColorVariant.noBackground` is deprecated. Use the `isPlain` prop on `DrawerPanelContent` and the `DrawerSection`instead.
15 */
16 DrawerColorVariant["noBackground"] = "no-background";
17 })(DrawerColorVariant || (exports.DrawerColorVariant = DrawerColorVariant = {}));
18 exports.DrawerContext = (0, react_1.createContext)({
19 isExpanded: false,
20 isStatic: false,
21 onExpand: () => { },
22 position: 'end',
23 drawerRef: null,
24 drawerContentRef: null,
25 isInline: false
26 });
27 const Drawer = (_a) => {
28 var { className = '', children, isExpanded = false, isInline = false, isPill = false, isStatic = false, position = 'end', onExpand = () => { } } = _a, props = tslib_1.__rest(_a, ["className", "children", "isExpanded", "isInline", "isPill", "isStatic", "position", "onExpand"]);
29 const drawerRef = (0, react_1.useRef)(undefined);
30 const drawerContentRef = (0, react_1.useRef)(undefined);
31 return ((0, jsx_runtime_1.jsx)(exports.DrawerContext.Provider, { value: { isExpanded, isStatic, onExpand, position, drawerRef, drawerContentRef, isInline }, children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, react_styles_1.css)(drawer_1.default.drawer, isExpanded && drawer_1.default.modifiers.expanded, isInline && drawer_1.default.modifiers.inline, isPill && drawer_1.default.modifiers.pill, isStatic && drawer_1.default.modifiers.static, (position === 'left' || position === 'start') && drawer_1.default.modifiers.panelLeft, position === 'bottom' && drawer_1.default.modifiers.panelBottom, className), ref: drawerRef }, props, { children: children })) }));
32 };
33 exports.Drawer = Drawer;
34 exports.Drawer.displayName = 'Drawer';
35 //# sourceMappingURL=Drawer.js.map