diff --git a/src/Disclosure/index.js b/src/Disclosure/index.js
new file mode 100644
index 0000000..e5e440a
--- /dev/null
+++ b/src/Disclosure/index.js
@@ -0,0 +1,25 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { wcBool } from '../utils';
+
+const Disclosure = ({ className, ariaControls, ariaExpanded, ...rest }) => {
+ return (
+
+ );
+};
+
+Disclosure.propTypes = {
+ ariaControls: PropTypes.string.isRequired,
+ ariaExpanded: PropTypes.bool,
+ role: PropTypes.string,
+ tabindex: PropTypes.string,
+ className: PropTypes.string,
+ children: PropTypes.node.isRequired,
+};
+
+export default Disclosure;
diff --git a/src/HxDiv/index.js b/src/Div/index.js
similarity index 75%
rename from src/HxDiv/index.js
rename to src/Div/index.js
index 28b584f..60715ab 100644
--- a/src/HxDiv/index.js
+++ b/src/Div/index.js
@@ -1,14 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';
-const HxDiv = ({ className, ...rest }) => {
+const Div = ({ className, ...rest }) => {
return ;
};
-HxDiv.propTypes = {
+Div.propTypes = {
className: PropTypes.string,
children: PropTypes.node.isRequired,
scroll: PropTypes.oneOf(['vertical', 'horizontal', 'both', 'none']),
};
-export default HxDiv;
+export default Div;
diff --git a/src/Drawer/stories.js b/src/Drawer/stories.js
index 9af4bc5..09843aa 100644
--- a/src/Drawer/stories.js
+++ b/src/Drawer/stories.js
@@ -5,7 +5,7 @@ import { storiesOf } from '@storybook/react';
import Drawer from './index';
import Button from '../Button';
-import HxDiv from '../HxDiv';
+import Div from '../Div';
import { getLongText } from '../storyUtils';
const SIZES = {
@@ -38,7 +38,7 @@ storiesOf('Drawer', module).add('All Knobs', () => {
onClose={action('onClose')}
>
{{header || defaultHeader}}
- {{body || defaultBody}}
+ {
{body || defaultBody}
}
{}
);
diff --git a/src/Modal/stories.js b/src/Modal/stories.js
index b460904..eecfa6e 100644
--- a/src/Modal/stories.js
+++ b/src/Modal/stories.js
@@ -3,7 +3,7 @@ import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { boolean, select, text } from '@storybook/addon-knobs/react';
import Modal from './index';
-import HxDiv from '../HxDiv';
+import Div from '../Div';
import Button from '../Button';
import { getLongText } from '../storyUtils';
@@ -43,10 +43,10 @@ storiesOf('Modal', module).add('All Knobs', () => {
{header}
)}
-
+
{smallText}
{scroll ? longText : null}
-
+
{}
);
diff --git a/src/Popover/index.js b/src/Popover/index.js
new file mode 100644
index 0000000..0b04eae
--- /dev/null
+++ b/src/Popover/index.js
@@ -0,0 +1,44 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import classNames from 'classnames';
+import useEventListener from '../hooks/useEventListener';
+import { POSITIONS } from '../constants';
+import { wcBool } from '../utils';
+
+const Popover = ({
+ onOpen,
+ onClose,
+ onReposition,
+ className,
+ open,
+ children,
+ relativeTo,
+ ...rest
+}) => {
+ const hxRef = useEventListener({ onOpen, onClose, onReposition });
+ return (
+
+ {children}
+
+ );
+};
+
+Popover.propTypes = {
+ children: PropTypes.node.isRequired,
+ className: PropTypes.string,
+ id: PropTypes.string,
+ position: PropTypes.oneOf(POSITIONS),
+ relativeTo: PropTypes.string,
+ open: PropTypes.bool,
+ onClose: PropTypes.func,
+ onOpen: PropTypes.func,
+ onReposition: PropTypes.func,
+};
+
+export default Popover;
diff --git a/src/Popover/stories.js b/src/Popover/stories.js
new file mode 100644
index 0000000..fab43ef
--- /dev/null
+++ b/src/Popover/stories.js
@@ -0,0 +1,51 @@
+import React from 'react';
+import { storiesOf } from '@storybook/react';
+import { action } from '@storybook/addon-actions';
+import centered from '@storybook/addon-centered/react';
+import { boolean, select, text } from '@storybook/addon-knobs/react';
+import Popover from '.';
+import Div from '../Div';
+import Button from '../Button';
+import { getLongText } from '../storyUtils';
+import { POSITIONS } from '../constants';
+import Disclosure from '../Disclosure';
+
+storiesOf('Popover', module)
+ .addDecorator(centered)
+ .add('All Knobs', () => {
+ let header = text('header', 'Popover Header');
+ let footer = text('footer', '');
+ let position = select('positions', POSITIONS, 'bottom-right');
+ let scroll = boolean('scroll', false);
+
+ const smallText = 'This is the body of a demo popover\n';
+ const longText = [1, 2, 3, 4, 5].map(() => {getLongText()}
);
+ const defaultFooter = (
+ <>
+
+
+ >
+ );
+
+ return (
+ <>
+
+
+
+
+ {header && }
+
+ {smallText}
+ {scroll ? longText : null}
+
+ {}
+
+ >
+ );
+ });
diff --git a/src/index.mjs b/src/index.mjs
index 9f6a358..779609e 100644
--- a/src/index.mjs
+++ b/src/index.mjs
@@ -3,8 +3,9 @@ import Button from './Button';
import Alert from './Alert';
import Drawer from './Drawer';
import Icon from './Icon';
-import Tooltip from './Tooltip';
import Modal from './Modal';
+import Popover from './Popover';
+import Tooltip from './Tooltip';
import Select from './Select';
export default {
@@ -13,6 +14,7 @@ export default {
Drawer,
Icon,
Modal,
+ Popover,
Select,
- Tooltip
+ Tooltip,
};