reshaped 3.8.0-canary.3 → 3.8.0-canary.4

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.
@@ -166,6 +166,7 @@ export const containerRef = () => {
166
166
  };
167
167
  export const edgeCases = () => {
168
168
  const menuModalToggle = useToggle();
169
+ const menuModalToggleInner = useToggle();
169
170
  const scrollModalToggle = useToggle();
170
171
  const inputRef = React.useRef(null);
171
172
  return (<Example>
@@ -233,7 +234,11 @@ export const edgeCases = () => {
233
234
  <DropdownMenu.Item>Item 2</DropdownMenu.Item>
234
235
  </DropdownMenu.Content>
235
236
  </DropdownMenu>
237
+ <Button onClick={menuModalToggleInner.activate}>Open dialog</Button>
236
238
  <Button onClick={menuModalToggle.deactivate}>Close</Button>
239
+ <Modal active={menuModalToggleInner.active} onClose={menuModalToggleInner.deactivate}>
240
+ <Button onClick={menuModalToggleInner.deactivate}>Close</Button>
241
+ </Modal>
237
242
  </View>
238
243
  </Modal>
239
244
  </Example.Item>
@@ -4,7 +4,6 @@
4
4
  */
5
5
  import React from "react";
6
6
  import useElementId from "../useElementId.js";
7
- import { onNextFrame } from "../../utilities/animation.js";
8
7
  let queue = {};
9
8
  let latestId = null;
10
9
  const removeFromQueue = (id) => {
@@ -28,19 +27,12 @@ const useIsDismissible = (args) => {
28
27
  React.useEffect(() => {
29
28
  if (!active)
30
29
  return;
31
- onNextFrame(() => addToQueue(id, contentRef, triggerRef));
30
+ addToQueue(id, contentRef, triggerRef);
32
31
  return () => removeFromQueue(id);
33
32
  }, [active, id, contentRef, triggerRef]);
34
33
  return React.useCallback(() => {
35
34
  if (!active)
36
35
  return true;
37
- const latest = latestId ? queue[latestId] : undefined;
38
- const latestTrigger = latest?.triggerRef?.current;
39
- const prev = latest?.parentId ? queue[latest.parentId] : undefined;
40
- const prevContent = prev?.contentRef.current;
41
- // Don't block independently rendered components that are not nested in each other
42
- if (!prevContent || !latestTrigger || !prevContent.contains(latestTrigger))
43
- return true;
44
36
  return latestId === id;
45
37
  }, [id, active]);
46
38
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reshaped",
3
3
  "description": "Professionally crafted design system in React & Figma for building products of any scale and complexity",
4
- "version": "3.8.0-canary.3",
4
+ "version": "3.8.0-canary.4",
5
5
  "license": "MIT",
6
6
  "email": "hello@reshaped.so",
7
7
  "homepage": "https://reshaped.so",