@wonderflow/react-components 2.18.5 → 2.18.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  list-style-type: none;
3
3
  padding: env(--space-8) 0 env(--space-8);
4
4
  background-color: var(--global-background);
5
- border: 1px solid var(--dimmed-0);
5
+ border: 1px solid var(--dimmed-1);
6
6
  border-radius: env(--radius-8);
7
7
  overflow: hidden;
8
8
  position: relative;
@@ -1,6 +1,6 @@
1
1
  import clsx from 'clsx';
2
- import React, { useState, Children, cloneElement } from 'react';
3
- import { useKey } from 'react-use';
2
+ import React, { useState, Children, cloneElement, useRef } from 'react';
3
+ import { useKey, useClickAway } from 'react-use';
4
4
  import { Dropdown as DropdownClass, PopUp } from './dropdown.module.css';
5
5
  import { useUIDSeed } from 'react-uid';
6
6
  import { useFocusWithin } from '@react-aria/interactions';
@@ -10,6 +10,7 @@ import { usePopperTooltip } from 'react-popper-tooltip';
10
10
  import { AnimatePresence, motion } from 'framer-motion';
11
11
  export const Dropdown = ({ className, children, trigger, offset = 8, placement = 'auto-start' }) => {
12
12
  const seedID = useUIDSeed();
13
+ const popupRef = useRef(null);
13
14
  const [isOpen, setIsOpen] = useState(false);
14
15
  const { getTooltipProps, setTooltipRef, setTriggerRef, visible } = usePopperTooltip({
15
16
  delayShow: 0,
@@ -19,9 +20,12 @@ export const Dropdown = ({ className, children, trigger, offset = 8, placement =
19
20
  closeOnTriggerHidden: true,
20
21
  onVisibleChange: setIsOpen,
21
22
  placement: placement,
22
- offset: [0, offset]
23
- }, {
24
- strategy: 'fixed'
23
+ interactive: true,
24
+ offset: [0, offset],
25
+ closeOnOutsideClick: false
26
+ });
27
+ useClickAway(popupRef, () => {
28
+ setIsOpen(false);
25
29
  });
26
30
  const { focusWithinProps } = useFocusWithin({
27
31
  onFocusWithin: () => null,
@@ -29,7 +33,7 @@ export const Dropdown = ({ className, children, trigger, offset = 8, placement =
29
33
  onFocusWithinChange: () => null
30
34
  });
31
35
  useKey('Escape', () => setIsOpen(false));
32
- return (React.createElement("div", Object.assign({ className: clsx(DropdownClass, className) }, focusWithinProps),
36
+ return (React.createElement("div", Object.assign({ ref: popupRef, className: clsx(DropdownClass, className) }, focusWithinProps),
33
37
  Children.map(trigger, (child) => cloneElement(child, {
34
38
  ref: setTriggerRef,
35
39
  id: seedID('dropdown-trigger'),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
3
  "description": "UI components from Wonderflow's Wanda design system",
4
- "version": "2.18.5",
4
+ "version": "2.18.6",
5
5
  "author": "Wonderflow",
6
6
  "license": "MIT",
7
7
  "main": "index.js",
package/themes/dark.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 24 Sep 2021 13:58:30 GMT
3
+ * Generated on Mon, 27 Sep 2021 07:30:47 GMT
4
4
  */
5
5
 
6
6
  :root {
package/themes/light.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 24 Sep 2021 13:58:30 GMT
3
+ * Generated on Mon, 27 Sep 2021 07:30:47 GMT
4
4
  */
5
5
 
6
6
  :root {
package/themes.css CHANGED
@@ -4,7 +4,7 @@
4
4
  color: var(--global-foreground);
5
5
  /**
6
6
  * Do not edit directly
7
- * Generated on Fri, 24 Sep 2021 13:58:30 GMT
7
+ * Generated on Mon, 27 Sep 2021 07:30:47 GMT
8
8
  */
9
9
 
10
10
 
@@ -51,7 +51,7 @@
51
51
  color: var(--global-foreground);
52
52
  /**
53
53
  * Do not edit directly
54
- * Generated on Fri, 24 Sep 2021 13:58:30 GMT
54
+ * Generated on Mon, 27 Sep 2021 07:30:47 GMT
55
55
  */
56
56
 
57
57
 
@@ -99,7 +99,7 @@
99
99
  color: var(--global-foreground);
100
100
  /**
101
101
  * Do not edit directly
102
- * Generated on Fri, 24 Sep 2021 13:58:30 GMT
102
+ * Generated on Mon, 27 Sep 2021 07:30:47 GMT
103
103
  */
104
104
 
105
105