| 1 |
import { __rest } from "tslib"; |
| 2 |
import { jsx as _jsx } from "react/jsx-runtime"; |
| 3 |
import { Children, cloneElement } from 'react'; |
| 4 |
import { css } from '@patternfly/react-styles'; |
| 5 |
import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop.mjs'; |
| 6 |
import { DroppableContext } from './DroppableContext'; |
| 7 |
export const Droppable = (_a) => { |
| 8 |
var { className, children, zone = 'defaultZone', droppableId = 'defaultId', hasNoWrapper = false } = _a, props = __rest(_a, ["className", "children", "zone", "droppableId", "hasNoWrapper"]); |
| 9 |
const childProps = Object.assign({ 'data-pf-droppable': zone, 'data-pf-droppableid': droppableId, |
| 10 |
// if has no wrapper is set, don't overwrite children className with the className prop |
| 11 |
className: hasNoWrapper && Children.count(children) === 1 |
| 12 |
? css(styles.droppable, className, children.props.className) |
| 13 |
: css(styles.droppable, className) }, props); |
| 14 |
return (_jsx(DroppableContext.Provider, { value: { zone, droppableId }, children: hasNoWrapper ? (cloneElement(children, childProps)) : (_jsx("div", Object.assign({}, childProps, { children: children }))) })); |
| 15 |
}; |
| 16 |
Droppable.displayName = 'Droppable'; |
| 17 |
//# sourceMappingURL=Droppable.js.map |