@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
23 lines (22 loc) • 775 B
JavaScript
import * as React from 'react';
import { createSubcomponent } from '@workday/canvas-kit-react/common';
import { usePopupModel, usePopupPopper } from './hooks';
import { Popper } from './Popper';
// We moved this out of the component function to prevent rebuilding this object on re-renders.
const popperOptions = {
modifiers: [
{
name: 'offset',
options: {
offset: () => [0, 4],
},
},
],
};
export const PopupPopper = createSubcomponent('div')({
displayName: 'Popup.Popper',
modelHook: usePopupModel,
elemPropsHook: usePopupPopper,
})(({ children, ...elemProps }) => {
return (React.createElement(Popper, { ...elemProps, popperOptions: popperOptions, ...elemProps }, children));
});