@snack-uikit/popover-private
Advanced tools
Comparing version
@@ -207,3 +207,3 @@ "use strict"; | ||
})) | ||
}); | ||
}, 'portal'); | ||
return (0, jsx_runtime_1.jsxs)(react_1.FloatingNode, { | ||
@@ -210,0 +210,0 @@ id: nodeId, |
@@ -16,4 +16,5 @@ "use strict"; | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const classnames_1 = __importDefault(require("classnames")); | ||
const react_1 = require("react"); | ||
const react_2 = require("react"); | ||
const react_is_1 = require("react-is"); | ||
@@ -72,5 +73,5 @@ const utils_1 = require("@snack-uikit/utils"); | ||
} = _ref2; | ||
if ((0, react_1.isValidElement)(children)) { | ||
if ((0, react_2.isValidElement)(children)) { | ||
if ((0, react_is_1.isForwardRef)(children) || (0, react_is_1.isValidElementType)(children) || disableSpanWrapper) { | ||
return (0, react_1.cloneElement)(children, Object.assign(Object.assign({}, getReferenceProps(Object.assign(Object.assign({}, children.props), { | ||
return (0, react_2.cloneElement)(children, Object.assign(Object.assign({}, getReferenceProps(Object.assign(Object.assign({}, children.props), { | ||
className: (0, classnames_1.default)(children.props.className, validElementWrapperClassName) | ||
@@ -80,24 +81,27 @@ }))), { | ||
// @ts-ignore | ||
ref: setReference | ||
ref: setReference, | ||
key: 'cloned-element' | ||
})); | ||
} | ||
return (0, jsx_runtime_1.jsx)("span", Object.assign({ | ||
return (0, react_1.createElement)("span", Object.assign({ | ||
className: validElementWrapperClassName, | ||
ref: setReference | ||
}, getReferenceProps(), { | ||
children: children | ||
})); | ||
key: 'wrapped-element' | ||
}), children); | ||
} | ||
if (typeof children === 'function') { | ||
return children({ | ||
getReferenceProps, | ||
ref: setReference | ||
}); | ||
return (0, jsx_runtime_1.jsx)(react_2.Fragment, { | ||
children: children({ | ||
getReferenceProps, | ||
ref: setReference | ||
}) | ||
}, 'function-element'); | ||
} | ||
return (0, jsx_runtime_1.jsx)("span", Object.assign({ | ||
return (0, react_1.createElement)("span", Object.assign({ | ||
className: validElementWrapperClassName, | ||
ref: setReference | ||
}, getReferenceProps(), { | ||
children: children | ||
})); | ||
key: 'wrapped-element' | ||
}), children); | ||
}; | ||
@@ -104,0 +108,0 @@ exports.getPopoverTriggerJSX = getPopoverTriggerJSX; |
@@ -128,3 +128,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
onTouchMove: stopPropagationTouch, | ||
}), { children: [popoverContent, middlewareData.arrow && (_jsx(Arrow, { placement: placement, x: middlewareData.arrow.x, y: middlewareData.arrow.y, arrowContainerClassName: arrowContainerClassName, arrowElementClassName: arrowElementClassName, arrowRef: arrowRef }))] })) })); | ||
}), { children: [popoverContent, middlewareData.arrow && (_jsx(Arrow, { placement: placement, x: middlewareData.arrow.x, y: middlewareData.arrow.y, arrowContainerClassName: arrowContainerClassName, arrowElementClassName: arrowElementClassName, arrowRef: arrowRef }))] })) }, 'portal')); | ||
return (_jsxs(FloatingNode, { id: nodeId, children: [children && | ||
@@ -131,0 +131,0 @@ getPopoverTriggerJSX({ |
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { createElement as _createElement } from "react"; | ||
import cn from 'classnames'; | ||
import { cloneElement, isValidElement, } from 'react'; | ||
import { cloneElement, Fragment, isValidElement, } from 'react'; | ||
import { isForwardRef, isValidElementType } from 'react-is'; | ||
@@ -47,10 +48,10 @@ import { isBrowser } from '@snack-uikit/utils'; | ||
// @ts-ignore | ||
ref: setReference })); | ||
ref: setReference, key: 'cloned-element' })); | ||
} | ||
return (_jsx("span", Object.assign({ className: validElementWrapperClassName, ref: setReference }, getReferenceProps(), { children: children }))); | ||
return (_createElement("span", Object.assign({ className: validElementWrapperClassName, ref: setReference }, getReferenceProps(), { key: 'wrapped-element' }), children)); | ||
} | ||
if (typeof children === 'function') { | ||
return children({ getReferenceProps, ref: setReference }); | ||
return _jsx(Fragment, { children: children({ getReferenceProps, ref: setReference }) }, 'function-element'); | ||
} | ||
return (_jsx("span", Object.assign({ className: validElementWrapperClassName, ref: setReference }, getReferenceProps(), { children: children }))); | ||
return (_createElement("span", Object.assign({ className: validElementWrapperClassName, ref: setReference }, getReferenceProps(), { key: 'wrapped-element' }), children)); | ||
}; | ||
@@ -57,0 +58,0 @@ export const getTriggerProps = (trigger) => { |
@@ -7,3 +7,3 @@ { | ||
"title": "Popover Private", | ||
"version": "0.14.4", | ||
"version": "0.14.5-preview-d9538faf.0", | ||
"sideEffects": [ | ||
@@ -49,3 +49,3 @@ "*.css", | ||
}, | ||
"gitHead": "c29d4a3f518a9a287566b4ccb7648b5243e1977b" | ||
"gitHead": "68f0d54d77d2ddc6307c6ee4d76aec53a2011cd1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
110498
0.51%1929
0.42%