@wonderflow/react-components 3.0.0-beta.15 → 3.0.0-beta.16

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.
@@ -1,4 +1,4 @@
1
- import { ReactNode, ForwardRefExoticComponent } from 'react';
1
+ import { ReactNode, FC, ForwardRefExoticComponent } from 'react';
2
2
  import { DropdownMenuProps } from './menu/dropdown-menu';
3
3
  import { DropdownItemProps } from './item/dropdown-item';
4
4
  import { DropdownItemCheckboxProps } from './item-checkbox/dropdown-item-checkbox';
@@ -27,7 +27,7 @@ export declare type DropdownProps = PropsWithClass & {
27
27
  */
28
28
  placement?: AutoPlacement | BasePlacement | VariationPlacement;
29
29
  };
30
- declare type DropdownComponent = ForwardRefExoticComponent<DropdownProps> & {
30
+ declare type DropdownComponent = FC<DropdownProps> & {
31
31
  Menu: ForwardRefExoticComponent<DropdownMenuProps>;
32
32
  Item: ForwardRefExoticComponent<DropdownItemProps>;
33
33
  ItemCheckbox: ForwardRefExoticComponent<DropdownItemCheckboxProps>;
@@ -1,8 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import clsx from 'clsx';
3
- import { useState, Children, cloneElement, useRef, forwardRef } from 'react';
4
- import { useKeyPress, useClickAway, useFocusWithin } from 'ahooks';
5
- import { Dropdown as DropdownClass, PopUp } from './dropdown.module.css';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, Children, cloneElement } from 'react';
3
+ import { useKeyPress, useClickAway } from 'ahooks';
4
+ import { PopUp } from './dropdown.module.css';
6
5
  import { useUIDSeed } from 'react-uid';
7
6
  import { DropdownMenu } from './menu/dropdown-menu';
8
7
  import { DropdownItem } from './item/dropdown-item';
@@ -27,14 +26,13 @@ const DropdownAnimation = {
27
26
  }
28
27
  }
29
28
  };
30
- export const Dropdown = forwardRef(({ className, children, trigger, offset = 8, placement = 'auto-start' }, forwardedRef) => {
29
+ export const Dropdown = ({ children, trigger, offset = 8, placement = 'auto-start' }) => {
31
30
  const renderedChildren = Children.toArray(children).filter(Boolean);
32
31
  const seedID = useUIDSeed();
33
- const popupRef = useRef(forwardedRef);
34
32
  const [isOpen, setIsOpen] = useState(false);
35
- const { getTooltipProps, setTooltipRef, setTriggerRef, visible } = usePopperTooltip({
33
+ const { getTooltipProps, setTooltipRef, setTriggerRef, tooltipRef, visible } = usePopperTooltip({
36
34
  delayShow: 0,
37
- delayHide: 200,
35
+ delayHide: 0,
38
36
  trigger: ['click'],
39
37
  visible: isOpen,
40
38
  closeOnTriggerHidden: true,
@@ -43,12 +41,11 @@ export const Dropdown = forwardRef(({ className, children, trigger, offset = 8,
43
41
  offset: [0, offset],
44
42
  closeOnOutsideClick: false
45
43
  });
46
- const isFocusWithin = useFocusWithin(popupRef);
47
44
  useClickAway(() => {
48
45
  setIsOpen(false);
49
- }, popupRef);
46
+ }, tooltipRef);
50
47
  useKeyPress('esc', () => setIsOpen(false));
51
- return (_jsxs("div", { ref: popupRef, "data-dropdown-has-focus-within": isFocusWithin, className: clsx(DropdownClass, className), children: [Children.map(trigger, (child) => cloneElement(child, {
48
+ return (_jsxs(_Fragment, { children: [Children.map(trigger, (child) => cloneElement(child, {
52
49
  ref: setTriggerRef,
53
50
  id: seedID('dropdown-trigger'),
54
51
  'aria-haspopup': 'true',
@@ -58,7 +55,7 @@ export const Dropdown = forwardRef(({ className, children, trigger, offset = 8,
58
55
  id: seedID('dropdown-menu'),
59
56
  'aria-labelledby': seedID('dropdown-trigger')
60
57
  })) }, void 0) }, void 0)) }, void 0)] }, void 0));
61
- });
58
+ };
62
59
  Dropdown.displayName = 'Dropdown';
63
60
  Dropdown.Menu = DropdownMenu;
64
61
  Dropdown.Item = DropdownItem;
@@ -1 +1 @@
1
- .Dropdown{display:inline-flex;position:relative}.PopUp{inline-size:max-content;z-index:2}
1
+ .PopUp{inline-size:max-content;z-index:2}
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": "3.0.0-beta.15",
4
+ "version": "3.0.0-beta.16",
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 Thu, 30 Dec 2021 08:47:13 GMT
3
+ * Generated on Thu, 30 Dec 2021 12:46:59 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 Thu, 30 Dec 2021 08:47:13 GMT
3
+ * Generated on Thu, 30 Dec 2021 12:46:59 GMT
4
4
  */
5
5
 
6
6
  :root {