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