@tamagui/dismissable 1.0.1-beta.108 → 1.0.1-beta.111
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.
- package/dist/cjs/Dismissable.js +20 -51
- package/dist/cjs/Dismissable.js.map +1 -1
- package/dist/cjs/Dismissable.native.js +1 -0
- package/dist/cjs/Dismissable.native.js.map +1 -1
- package/dist/cjs/DismissableProps.js +1 -0
- package/dist/cjs/DismissableProps.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/Dismissable.js +19 -53
- package/dist/esm/Dismissable.js.map +1 -1
- package/dist/jsx/Dismissable.js +4 -3
- package/dist/jsx/Dismissable.js.map +1 -1
- package/package.json +5 -5
package/dist/cjs/Dismissable.js
CHANGED
|
@@ -1,38 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
8
|
var __export = (target, all) => {
|
|
37
9
|
for (var name in all)
|
|
38
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -76,21 +48,15 @@ const DismissableContext = React.createContext({
|
|
|
76
48
|
branches: /* @__PURE__ */ new Set()
|
|
77
49
|
});
|
|
78
50
|
const Dismissable = React.forwardRef((props, forwardedRef) => {
|
|
79
|
-
const
|
|
51
|
+
const {
|
|
80
52
|
disableOutsidePointerEvents = false,
|
|
81
53
|
onEscapeKeyDown,
|
|
82
54
|
onPointerDownOutside,
|
|
83
55
|
onFocusOutside,
|
|
84
56
|
onInteractOutside,
|
|
85
|
-
onDismiss
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"onEscapeKeyDown",
|
|
89
|
-
"onPointerDownOutside",
|
|
90
|
-
"onFocusOutside",
|
|
91
|
-
"onInteractOutside",
|
|
92
|
-
"onDismiss"
|
|
93
|
-
]);
|
|
57
|
+
onDismiss,
|
|
58
|
+
...layerProps
|
|
59
|
+
} = props;
|
|
94
60
|
const context = React.useContext(DismissableContext);
|
|
95
61
|
const [node, setNode] = React.useState(null);
|
|
96
62
|
const [, force] = React.useState({});
|
|
@@ -163,16 +129,18 @@ const Dismissable = React.forwardRef((props, forwardedRef) => {
|
|
|
163
129
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
164
130
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
165
131
|
}, []);
|
|
166
|
-
return /* @__PURE__ */ React.createElement("div",
|
|
132
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
133
|
+
...layerProps,
|
|
167
134
|
ref: composedRefs,
|
|
168
|
-
style:
|
|
135
|
+
style: {
|
|
169
136
|
display: "contents",
|
|
170
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0
|
|
171
|
-
|
|
137
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
138
|
+
...props.style
|
|
139
|
+
},
|
|
172
140
|
onFocusCapture: (0, import_core.composeEventHandlers)(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
173
141
|
onBlurCapture: (0, import_core.composeEventHandlers)(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
174
142
|
onPointerDownCapture: (0, import_core.composeEventHandlers)(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
175
|
-
})
|
|
143
|
+
});
|
|
176
144
|
});
|
|
177
145
|
Dismissable.displayName = DISMISSABLE_LAYER_NAME;
|
|
178
146
|
const BRANCH_NAME = "DismissableBranch";
|
|
@@ -189,11 +157,11 @@ const DismissableBranch = React.forwardRef((props, forwardedRef) => {
|
|
|
189
157
|
};
|
|
190
158
|
}
|
|
191
159
|
}, [context.branches]);
|
|
192
|
-
return /* @__PURE__ */ React.createElement("div",
|
|
193
|
-
style: { display: "contents" }
|
|
194
|
-
|
|
160
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
161
|
+
style: { display: "contents" },
|
|
162
|
+
...props,
|
|
195
163
|
ref: composedRefs
|
|
196
|
-
})
|
|
164
|
+
});
|
|
197
165
|
});
|
|
198
166
|
DismissableBranch.displayName = BRANCH_NAME;
|
|
199
167
|
function usePointerDownOutside(onPointerDownOutside) {
|
|
@@ -204,16 +172,17 @@ function usePointerDownOutside(onPointerDownOutside) {
|
|
|
204
172
|
React.useEffect(() => {
|
|
205
173
|
const handlePointerDown = (event) => {
|
|
206
174
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
207
|
-
let
|
|
175
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
208
176
|
handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true });
|
|
209
177
|
};
|
|
178
|
+
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
210
179
|
const eventDetail = { originalEvent: event };
|
|
211
180
|
if (event.pointerType === "touch") {
|
|
212
181
|
document.removeEventListener("click", handleClickRef.current);
|
|
213
|
-
handleClickRef.current =
|
|
182
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
214
183
|
document.addEventListener("click", handleClickRef.current, { once: true });
|
|
215
184
|
} else {
|
|
216
|
-
|
|
185
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
217
186
|
}
|
|
218
187
|
}
|
|
219
188
|
isPointerInsideReactTreeRef.current = false;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Dismissable.tsx"],
|
|
4
4
|
"sourcesContent": ["// forked from radix-ui\n// https://github.com/radix-ui/primitives/blob/cfd8dcba5fa6a0e751486af418d05a7b88a7f541/packages/react/dismissable-layer/src/DismissableLayer.tsx#L324\n\nimport { useEscapeKeydown } from '@radix-ui/react-use-escape-keydown'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { composeEventHandlers } from '@tamagui/core'\nimport { useEvent } from '@tamagui/use-event'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport { DismissableBranchProps, DismissableProps } from './DismissableProps'\n\nfunction dispatchDiscreteCustomEvent<E extends CustomEvent>(target: E['target'], event: E) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event))\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Dismissable\n * -----------------------------------------------------------------------------------------------*/\n\nconst DISMISSABLE_LAYER_NAME = 'Dismissable'\nconst CONTEXT_UPDATE = 'dismissable.update'\nconst POINTER_DOWN_OUTSIDE = 'dismissable.pointerDownOutside'\nconst FOCUS_OUTSIDE = 'dismissable.focusOutside'\n\nlet originalBodyPointerEvents: string\n\nconst DismissableContext = React.createContext({\n layers: new Set<HTMLDivElement>(),\n layersWithOutsidePointerEventsDisabled: new Set<HTMLDivElement>(),\n branches: new Set<HTMLDivElement>(),\n})\n\nconst Dismissable = React.forwardRef<HTMLDivElement, DismissableProps>((props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props\n const context = React.useContext(DismissableContext)\n const [node, setNode] = React.useState<HTMLDivElement | null>(null)\n const [, force] = React.useState({})\n const composedRefs = useComposedRefs(forwardedRef, (node) => setNode(node))\n const layers = Array.from(context.layers)\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1); // prettier-ignore\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore\n const index = node ? layers.indexOf(node) : -1\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex\n\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target as HTMLDivElement\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target))\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return\n onPointerDownOutside?.(event)\n onInteractOutside?.(event)\n if (!event.defaultPrevented) onDismiss?.()\n })\n\n const focusOutside = useFocusOutside((event) => {\n const target = event.target as HTMLDivElement\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target))\n if (isFocusInBranch) return\n onFocusOutside?.(event)\n onInteractOutside?.(event)\n if (!event.defaultPrevented) onDismiss?.()\n })\n\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1\n if (!isHighestLayer) return\n onEscapeKeyDown?.(event)\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault()\n onDismiss()\n }\n })\n\n React.useEffect(() => {\n if (!node) return\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = document.body.style.pointerEvents\n document.body.style.pointerEvents = 'none'\n }\n context.layersWithOutsidePointerEventsDisabled.add(node)\n }\n context.layers.add(node)\n dispatchUpdate()\n return () => {\n if (\n disableOutsidePointerEvents &&\n context.layersWithOutsidePointerEventsDisabled.size === 1\n ) {\n document.body.style.pointerEvents = originalBodyPointerEvents\n }\n }\n }, [node, disableOutsidePointerEvents, context])\n\n /**\n * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect\n * because a change to `disableOutsidePointerEvents` would remove this layer from the stack\n * and add it to the end again so the layering order wouldn't be _creation order_.\n * We only want them to be removed from context stacks when unmounted.\n */\n React.useEffect(() => {\n return () => {\n if (!node) return\n context.layers.delete(node)\n context.layersWithOutsidePointerEventsDisabled.delete(node)\n dispatchUpdate()\n }\n }, [node, context])\n\n React.useEffect(() => {\n const handleUpdate = () => force({})\n document.addEventListener(CONTEXT_UPDATE, handleUpdate)\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate)\n }, [])\n\n return (\n <div\n {...layerProps}\n // @ts-ignore\n ref={composedRefs}\n style={{\n display: 'contents',\n pointerEvents: isBodyPointerEventsDisabled\n ? isPointerEventsEnabled\n ? 'auto'\n : 'none'\n : undefined,\n // @ts-ignore\n ...props.style,\n }}\n onFocusCapture={composeEventHandlers(\n // @ts-ignore\n props.onFocusCapture,\n focusOutside.onFocusCapture\n )}\n onBlurCapture={composeEventHandlers(\n // @ts-ignore\n props.onBlurCapture,\n focusOutside.onBlurCapture\n )}\n // @ts-ignore\n onPointerDownCapture={composeEventHandlers(\n // @ts-ignore\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )}\n />\n )\n})\n\nDismissable.displayName = DISMISSABLE_LAYER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableBranch\n * -----------------------------------------------------------------------------------------------*/\n\nconst BRANCH_NAME = 'DismissableBranch'\n\nconst DismissableBranch = React.forwardRef<HTMLDivElement, DismissableBranchProps>(\n (props, forwardedRef) => {\n const context = React.useContext(DismissableContext)\n const ref = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n\n React.useEffect(() => {\n const node = ref.current\n if (node) {\n context.branches.add(node)\n return () => {\n context.branches.delete(node)\n }\n }\n }, [context.branches])\n\n return <div style={{ display: 'contents' }} {...props} ref={composedRefs} />\n }\n)\n\nDismissableBranch.displayName = BRANCH_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport type PointerDownOutsideEvent = CustomEvent<{ originalEvent: PointerEvent }>\nexport type FocusOutsideEvent = CustomEvent<{ originalEvent: FocusEvent }>\n\n/**\n * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`\n * to mimic layer dismissing behaviour present in OS.\n * Returns props to pass to the node we want to check for outside events.\n */\nfunction usePointerDownOutside(onPointerDownOutside?: (event: PointerDownOutsideEvent) => void) {\n const handlePointerDownOutside = useEvent(onPointerDownOutside) as EventListener\n const isPointerInsideReactTreeRef = React.useRef(false)\n const handleClickRef = React.useRef(() => {})\n\n React.useEffect(() => {\n const handlePointerDown = (event: PointerEvent) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event }\n\n function handleAndDispatchPointerDownOutsideEvent() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n )\n }\n\n /**\n * On touch devices, we need to wait for a click event because browsers implement\n * a ~350ms delay between the time the user stops touching the display and when the\n * browser executres events. We need to ensure we don't reactivate pointer-events within\n * this timeframe otherwise the browser may execute events that should have been prevented.\n *\n * Additionally, this also lets us deal automatically with cancellations when a click event\n * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.\n *\n * This is why we also continuously remove the previous listener, because we cannot be\n * certain that it was raised, and therefore cleaned-up.\n */\n if (event.pointerType === 'touch') {\n document.removeEventListener('click', handleClickRef.current)\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent\n document.addEventListener('click', handleClickRef.current, { once: true })\n } else {\n handleAndDispatchPointerDownOutsideEvent()\n }\n }\n isPointerInsideReactTreeRef.current = false\n }\n /**\n * if this hook executes in a component that mounts via a `pointerdown` event, the event\n * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n * this by delaying the event listener registration on the document.\n * This is not React specific, but rather how the DOM works, ie:\n * ```\n * button.addEventListener('pointerdown', () => {\n * console.log('I will log');\n * document.addEventListener('pointerdown', () => {\n * console.log('I will also log');\n * })\n * });\n */\n const timerId = window.setTimeout(() => {\n document.addEventListener('pointerdown', handlePointerDown)\n }, 0)\n return () => {\n window.clearTimeout(timerId)\n document.removeEventListener('pointerdown', handlePointerDown)\n document.removeEventListener('click', handleClickRef.current)\n }\n }, [handlePointerDownOutside])\n\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => (isPointerInsideReactTreeRef.current = true),\n }\n}\n\n/**\n * Listens for when focus happens outside a react subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */\nfunction useFocusOutside(onFocusOutside?: (event: FocusOutsideEvent) => void) {\n const handleFocusOutside = useEvent(onFocusOutside) as EventListener\n const isFocusInsideReactTreeRef = React.useRef(false)\n\n React.useEffect(() => {\n const handleFocus = (event: FocusEvent) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event }\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false,\n })\n }\n }\n document.addEventListener('focusin', handleFocus)\n return () => document.removeEventListener('focusin', handleFocus)\n }, [handleFocusOutside])\n\n return {\n onFocusCapture: () => (isFocusInsideReactTreeRef.current = true),\n onBlurCapture: () => (isFocusInsideReactTreeRef.current = false),\n }\n}\n\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE)\n document.dispatchEvent(event)\n}\n\nfunction handleAndDispatchCustomEvent<E extends CustomEvent, OriginalEvent extends Event>(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: OriginalEvent } & (E extends CustomEvent<infer D> ? D : never),\n { discrete }: { discrete: boolean }\n) {\n const target = detail.originalEvent.target\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail })\n if (handler) target.addEventListener(name, handler as EventListener, { once: true })\n\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event)\n } else {\n target.dispatchEvent(event)\n }\n}\n\nconst Root = Dismissable\nconst Branch = DismissableBranch\n\nexport {\n Dismissable,\n DismissableBranch,\n //\n Root,\n Branch,\n}\n\nexport type { DismissableProps }\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sCAAiC;AACjC,0BAAgC;AAChC,kBAAqC;AACrC,uBAAyB;AACzB,YAAuB;AACvB,eAA0B;AAI1B,qCAA4D,QAAqB,OAAU;AACzF,MAAI;AAAQ,aAAS,UAAU,MAAM,OAAO,cAAc,KAAK,CAAC;AAClE;AAMA,MAAM,yBAAyB;AAC/B,MAAM,iBAAiB;AACvB,MAAM,uBAAuB;AAC7B,MAAM,gBAAgB;AAEtB,IAAI;AAEJ,MAAM,qBAAqB,MAAM,cAAc;AAAA,EAC7C,QAAQ,oB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,YAAY,MAAM,OAAO,CAAC;AAChF,MAAI;AAAS,WAAO,iBAAiB,MAAM,SAA0B,EAAE,MAAM,KAAK,CAAC;AAEnF,MAAI,UAAU;AACZ,gCAA4B,QAAQ,KAAK;AAAA,EAC3C,OAAO;AACL,WAAO,cAAc,KAAK;AAAA,EAC5B;AACF;AAEA,MAAM,OAAO;AACb,MAAM,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Dismissable.native.tsx"],
|
|
4
4
|
"sourcesContent": ["import { forwardRef } from 'react'\n\nimport { DismissableBranchProps, DismissableProps } from './DismissableProps'\n\nexport const Dismissable = forwardRef((props: DismissableProps, _ref) => {\n return props.children as any\n})\n\nexport const DismissableBranch = forwardRef((props: DismissableBranchProps, _ref) => {\n return props.children as any\n})\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAIpB,MAAM,cAAc,6BAAW,CAAC,OAAyB,SAAS;AACvE,SAAO,MAAM;AACf,CAAC;AAEM,MAAM,oBAAoB,6BAAW,CAAC,OAA+B,SAAS;AACnF,SAAO,MAAM;AACf,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DismissableProps.tsx"],
|
|
4
4
|
"sourcesContent": ["import React from 'react'\n\nimport { FocusOutsideEvent, PointerDownOutsideEvent } from './Dismissable'\n\nexport interface DismissableProps {\n /**\n * When `true`, hover/focus/click interactions will be disabled on elements outside\n * the `Dismissable`. Users will need to click twice on outside elements to\n * interact with them: once to close the `Dismissable`, and again to trigger the element.\n */\n disableOutsidePointerEvents?: boolean\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `Dismissable`.\n * Can be prevented.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n /**\n * Event handler called when the focus moves outside of the `Dismissable`.\n * Can be prevented.\n */\n onFocusOutside?: (event: FocusOutsideEvent) => void\n /**\n * Event handler called when an interaction happens outside the `Dismissable`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: (event: PointerDownOutsideEvent | FocusOutsideEvent) => void\n /**\n * Handler called when the `Dismissable` should be dismissed\n */\n onDismiss?: () => void\n\n children?: React.ReactNode\n}\n\nexport interface DismissableBranchProps {\n children?: React.ReactNode\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
package/dist/cjs/index.js.map
CHANGED
package/dist/esm/Dismissable.js
CHANGED
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
1
|
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
|
33
2
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
34
3
|
import { composeEventHandlers } from "@tamagui/core";
|
|
@@ -50,21 +19,15 @@ const DismissableContext = React.createContext({
|
|
|
50
19
|
branches: /* @__PURE__ */ new Set()
|
|
51
20
|
});
|
|
52
21
|
const Dismissable = React.forwardRef((props, forwardedRef) => {
|
|
53
|
-
const
|
|
22
|
+
const {
|
|
54
23
|
disableOutsidePointerEvents = false,
|
|
55
24
|
onEscapeKeyDown,
|
|
56
25
|
onPointerDownOutside,
|
|
57
26
|
onFocusOutside,
|
|
58
27
|
onInteractOutside,
|
|
59
|
-
onDismiss
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"onEscapeKeyDown",
|
|
63
|
-
"onPointerDownOutside",
|
|
64
|
-
"onFocusOutside",
|
|
65
|
-
"onInteractOutside",
|
|
66
|
-
"onDismiss"
|
|
67
|
-
]);
|
|
28
|
+
onDismiss,
|
|
29
|
+
...layerProps
|
|
30
|
+
} = props;
|
|
68
31
|
const context = React.useContext(DismissableContext);
|
|
69
32
|
const [node, setNode] = React.useState(null);
|
|
70
33
|
const [, force] = React.useState({});
|
|
@@ -137,16 +100,18 @@ const Dismissable = React.forwardRef((props, forwardedRef) => {
|
|
|
137
100
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
138
101
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
139
102
|
}, []);
|
|
140
|
-
return /* @__PURE__ */ React.createElement("div",
|
|
103
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
104
|
+
...layerProps,
|
|
141
105
|
ref: composedRefs,
|
|
142
|
-
style:
|
|
106
|
+
style: {
|
|
143
107
|
display: "contents",
|
|
144
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0
|
|
145
|
-
|
|
108
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
109
|
+
...props.style
|
|
110
|
+
},
|
|
146
111
|
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
147
112
|
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
148
113
|
onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
149
|
-
})
|
|
114
|
+
});
|
|
150
115
|
});
|
|
151
116
|
Dismissable.displayName = DISMISSABLE_LAYER_NAME;
|
|
152
117
|
const BRANCH_NAME = "DismissableBranch";
|
|
@@ -163,11 +128,11 @@ const DismissableBranch = React.forwardRef((props, forwardedRef) => {
|
|
|
163
128
|
};
|
|
164
129
|
}
|
|
165
130
|
}, [context.branches]);
|
|
166
|
-
return /* @__PURE__ */ React.createElement("div",
|
|
167
|
-
style: { display: "contents" }
|
|
168
|
-
|
|
131
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
132
|
+
style: { display: "contents" },
|
|
133
|
+
...props,
|
|
169
134
|
ref: composedRefs
|
|
170
|
-
})
|
|
135
|
+
});
|
|
171
136
|
});
|
|
172
137
|
DismissableBranch.displayName = BRANCH_NAME;
|
|
173
138
|
function usePointerDownOutside(onPointerDownOutside) {
|
|
@@ -178,16 +143,17 @@ function usePointerDownOutside(onPointerDownOutside) {
|
|
|
178
143
|
React.useEffect(() => {
|
|
179
144
|
const handlePointerDown = (event) => {
|
|
180
145
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
181
|
-
let
|
|
146
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
182
147
|
handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true });
|
|
183
148
|
};
|
|
149
|
+
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
184
150
|
const eventDetail = { originalEvent: event };
|
|
185
151
|
if (event.pointerType === "touch") {
|
|
186
152
|
document.removeEventListener("click", handleClickRef.current);
|
|
187
|
-
handleClickRef.current =
|
|
153
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
188
154
|
document.addEventListener("click", handleClickRef.current, { once: true });
|
|
189
155
|
} else {
|
|
190
|
-
|
|
156
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
191
157
|
}
|
|
192
158
|
}
|
|
193
159
|
isPointerInsideReactTreeRef.current = false;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Dismissable.tsx"],
|
|
4
4
|
"sourcesContent": ["// forked from radix-ui\n// https://github.com/radix-ui/primitives/blob/cfd8dcba5fa6a0e751486af418d05a7b88a7f541/packages/react/dismissable-layer/src/DismissableLayer.tsx#L324\n\nimport { useEscapeKeydown } from '@radix-ui/react-use-escape-keydown'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { composeEventHandlers } from '@tamagui/core'\nimport { useEvent } from '@tamagui/use-event'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport { DismissableBranchProps, DismissableProps } from './DismissableProps'\n\nfunction dispatchDiscreteCustomEvent<E extends CustomEvent>(target: E['target'], event: E) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event))\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Dismissable\n * -----------------------------------------------------------------------------------------------*/\n\nconst DISMISSABLE_LAYER_NAME = 'Dismissable'\nconst CONTEXT_UPDATE = 'dismissable.update'\nconst POINTER_DOWN_OUTSIDE = 'dismissable.pointerDownOutside'\nconst FOCUS_OUTSIDE = 'dismissable.focusOutside'\n\nlet originalBodyPointerEvents: string\n\nconst DismissableContext = React.createContext({\n layers: new Set<HTMLDivElement>(),\n layersWithOutsidePointerEventsDisabled: new Set<HTMLDivElement>(),\n branches: new Set<HTMLDivElement>(),\n})\n\nconst Dismissable = React.forwardRef<HTMLDivElement, DismissableProps>((props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props\n const context = React.useContext(DismissableContext)\n const [node, setNode] = React.useState<HTMLDivElement | null>(null)\n const [, force] = React.useState({})\n const composedRefs = useComposedRefs(forwardedRef, (node) => setNode(node))\n const layers = Array.from(context.layers)\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1); // prettier-ignore\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore\n const index = node ? layers.indexOf(node) : -1\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex\n\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target as HTMLDivElement\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target))\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return\n onPointerDownOutside?.(event)\n onInteractOutside?.(event)\n if (!event.defaultPrevented) onDismiss?.()\n })\n\n const focusOutside = useFocusOutside((event) => {\n const target = event.target as HTMLDivElement\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target))\n if (isFocusInBranch) return\n onFocusOutside?.(event)\n onInteractOutside?.(event)\n if (!event.defaultPrevented) onDismiss?.()\n })\n\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1\n if (!isHighestLayer) return\n onEscapeKeyDown?.(event)\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault()\n onDismiss()\n }\n })\n\n React.useEffect(() => {\n if (!node) return\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = document.body.style.pointerEvents\n document.body.style.pointerEvents = 'none'\n }\n context.layersWithOutsidePointerEventsDisabled.add(node)\n }\n context.layers.add(node)\n dispatchUpdate()\n return () => {\n if (\n disableOutsidePointerEvents &&\n context.layersWithOutsidePointerEventsDisabled.size === 1\n ) {\n document.body.style.pointerEvents = originalBodyPointerEvents\n }\n }\n }, [node, disableOutsidePointerEvents, context])\n\n /**\n * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect\n * because a change to `disableOutsidePointerEvents` would remove this layer from the stack\n * and add it to the end again so the layering order wouldn't be _creation order_.\n * We only want them to be removed from context stacks when unmounted.\n */\n React.useEffect(() => {\n return () => {\n if (!node) return\n context.layers.delete(node)\n context.layersWithOutsidePointerEventsDisabled.delete(node)\n dispatchUpdate()\n }\n }, [node, context])\n\n React.useEffect(() => {\n const handleUpdate = () => force({})\n document.addEventListener(CONTEXT_UPDATE, handleUpdate)\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate)\n }, [])\n\n return (\n <div\n {...layerProps}\n // @ts-ignore\n ref={composedRefs}\n style={{\n display: 'contents',\n pointerEvents: isBodyPointerEventsDisabled\n ? isPointerEventsEnabled\n ? 'auto'\n : 'none'\n : undefined,\n // @ts-ignore\n ...props.style,\n }}\n onFocusCapture={composeEventHandlers(\n // @ts-ignore\n props.onFocusCapture,\n focusOutside.onFocusCapture\n )}\n onBlurCapture={composeEventHandlers(\n // @ts-ignore\n props.onBlurCapture,\n focusOutside.onBlurCapture\n )}\n // @ts-ignore\n onPointerDownCapture={composeEventHandlers(\n // @ts-ignore\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )}\n />\n )\n})\n\nDismissable.displayName = DISMISSABLE_LAYER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableBranch\n * -----------------------------------------------------------------------------------------------*/\n\nconst BRANCH_NAME = 'DismissableBranch'\n\nconst DismissableBranch = React.forwardRef<HTMLDivElement, DismissableBranchProps>(\n (props, forwardedRef) => {\n const context = React.useContext(DismissableContext)\n const ref = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n\n React.useEffect(() => {\n const node = ref.current\n if (node) {\n context.branches.add(node)\n return () => {\n context.branches.delete(node)\n }\n }\n }, [context.branches])\n\n return <div style={{ display: 'contents' }} {...props} ref={composedRefs} />\n }\n)\n\nDismissableBranch.displayName = BRANCH_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport type PointerDownOutsideEvent = CustomEvent<{ originalEvent: PointerEvent }>\nexport type FocusOutsideEvent = CustomEvent<{ originalEvent: FocusEvent }>\n\n/**\n * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`\n * to mimic layer dismissing behaviour present in OS.\n * Returns props to pass to the node we want to check for outside events.\n */\nfunction usePointerDownOutside(onPointerDownOutside?: (event: PointerDownOutsideEvent) => void) {\n const handlePointerDownOutside = useEvent(onPointerDownOutside) as EventListener\n const isPointerInsideReactTreeRef = React.useRef(false)\n const handleClickRef = React.useRef(() => {})\n\n React.useEffect(() => {\n const handlePointerDown = (event: PointerEvent) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event }\n\n function handleAndDispatchPointerDownOutsideEvent() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n )\n }\n\n /**\n * On touch devices, we need to wait for a click event because browsers implement\n * a ~350ms delay between the time the user stops touching the display and when the\n * browser executres events. We need to ensure we don't reactivate pointer-events within\n * this timeframe otherwise the browser may execute events that should have been prevented.\n *\n * Additionally, this also lets us deal automatically with cancellations when a click event\n * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.\n *\n * This is why we also continuously remove the previous listener, because we cannot be\n * certain that it was raised, and therefore cleaned-up.\n */\n if (event.pointerType === 'touch') {\n document.removeEventListener('click', handleClickRef.current)\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent\n document.addEventListener('click', handleClickRef.current, { once: true })\n } else {\n handleAndDispatchPointerDownOutsideEvent()\n }\n }\n isPointerInsideReactTreeRef.current = false\n }\n /**\n * if this hook executes in a component that mounts via a `pointerdown` event, the event\n * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n * this by delaying the event listener registration on the document.\n * This is not React specific, but rather how the DOM works, ie:\n * ```\n * button.addEventListener('pointerdown', () => {\n * console.log('I will log');\n * document.addEventListener('pointerdown', () => {\n * console.log('I will also log');\n * })\n * });\n */\n const timerId = window.setTimeout(() => {\n document.addEventListener('pointerdown', handlePointerDown)\n }, 0)\n return () => {\n window.clearTimeout(timerId)\n document.removeEventListener('pointerdown', handlePointerDown)\n document.removeEventListener('click', handleClickRef.current)\n }\n }, [handlePointerDownOutside])\n\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => (isPointerInsideReactTreeRef.current = true),\n }\n}\n\n/**\n * Listens for when focus happens outside a react subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */\nfunction useFocusOutside(onFocusOutside?: (event: FocusOutsideEvent) => void) {\n const handleFocusOutside = useEvent(onFocusOutside) as EventListener\n const isFocusInsideReactTreeRef = React.useRef(false)\n\n React.useEffect(() => {\n const handleFocus = (event: FocusEvent) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event }\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false,\n })\n }\n }\n document.addEventListener('focusin', handleFocus)\n return () => document.removeEventListener('focusin', handleFocus)\n }, [handleFocusOutside])\n\n return {\n onFocusCapture: () => (isFocusInsideReactTreeRef.current = true),\n onBlurCapture: () => (isFocusInsideReactTreeRef.current = false),\n }\n}\n\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE)\n document.dispatchEvent(event)\n}\n\nfunction handleAndDispatchCustomEvent<E extends CustomEvent, OriginalEvent extends Event>(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: OriginalEvent } & (E extends CustomEvent<infer D> ? D : never),\n { discrete }: { discrete: boolean }\n) {\n const target = detail.originalEvent.target\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail })\n if (handler) target.addEventListener(name, handler as EventListener, { once: true })\n\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event)\n } else {\n target.dispatchEvent(event)\n }\n}\n\nconst Root = Dismissable\nconst Branch = DismissableBranch\n\nexport {\n Dismissable,\n DismissableBranch,\n //\n Root,\n Branch,\n}\n\nexport type { DismissableProps }\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAGA;AACA;AACA;AACA;AACA;AACA;AAIA,qCAA4D,QAAqB,OAAU;AACzF,MAAI;AAAQ,aAAS,UAAU,MAAM,OAAO,cAAc,KAAK,CAAC;AAClE;AAMA,MAAM,yBAAyB;AAC/B,MAAM,iBAAiB;AACvB,MAAM,uBAAuB;AAC7B,MAAM,gBAAgB;AAEtB,IAAI;AAEJ,MAAM,qBAAqB,MAAM,cAAc;AAAA,EAC7C,QAAQ,oBAAI,IAAoB;AAAA,EAChC,wCAAwC,oBAAI,IAAoB;AAAA,EAChE,UAAU,oBAAI,IAAoB;AACpC,CAAC;AAED,MAAM,cAAc,MAAM,WAA6C,CAAC,OAAO,iBAAiB;AAC9F,QAAM;AAAA,IACJ,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O,cAAc,KAAK;AAAA,EAC5B;AACF;AAEA,MAAM,OAAO;AACb,MAAM,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/Dismissable.js
CHANGED
|
@@ -132,16 +132,17 @@ function usePointerDownOutside(onPointerDownOutside) {
|
|
|
132
132
|
React.useEffect(() => {
|
|
133
133
|
const handlePointerDown = (event) => {
|
|
134
134
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
135
|
-
let
|
|
135
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
136
136
|
handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true });
|
|
137
137
|
};
|
|
138
|
+
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
138
139
|
const eventDetail = { originalEvent: event };
|
|
139
140
|
if (event.pointerType === "touch") {
|
|
140
141
|
document.removeEventListener("click", handleClickRef.current);
|
|
141
|
-
handleClickRef.current =
|
|
142
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
142
143
|
document.addEventListener("click", handleClickRef.current, { once: true });
|
|
143
144
|
} else {
|
|
144
|
-
|
|
145
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
isPointerInsideReactTreeRef.current = false;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Dismissable.tsx"],
|
|
4
4
|
"sourcesContent": ["// forked from radix-ui\n// https://github.com/radix-ui/primitives/blob/cfd8dcba5fa6a0e751486af418d05a7b88a7f541/packages/react/dismissable-layer/src/DismissableLayer.tsx#L324\n\nimport { useEscapeKeydown } from '@radix-ui/react-use-escape-keydown'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { composeEventHandlers } from '@tamagui/core'\nimport { useEvent } from '@tamagui/use-event'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport { DismissableBranchProps, DismissableProps } from './DismissableProps'\n\nfunction dispatchDiscreteCustomEvent<E extends CustomEvent>(target: E['target'], event: E) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event))\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Dismissable\n * -----------------------------------------------------------------------------------------------*/\n\nconst DISMISSABLE_LAYER_NAME = 'Dismissable'\nconst CONTEXT_UPDATE = 'dismissable.update'\nconst POINTER_DOWN_OUTSIDE = 'dismissable.pointerDownOutside'\nconst FOCUS_OUTSIDE = 'dismissable.focusOutside'\n\nlet originalBodyPointerEvents: string\n\nconst DismissableContext = React.createContext({\n layers: new Set<HTMLDivElement>(),\n layersWithOutsidePointerEventsDisabled: new Set<HTMLDivElement>(),\n branches: new Set<HTMLDivElement>(),\n})\n\nconst Dismissable = React.forwardRef<HTMLDivElement, DismissableProps>((props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props\n const context = React.useContext(DismissableContext)\n const [node, setNode] = React.useState<HTMLDivElement | null>(null)\n const [, force] = React.useState({})\n const composedRefs = useComposedRefs(forwardedRef, (node) => setNode(node))\n const layers = Array.from(context.layers)\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1); // prettier-ignore\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore\n const index = node ? layers.indexOf(node) : -1\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex\n\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target as HTMLDivElement\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target))\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return\n onPointerDownOutside?.(event)\n onInteractOutside?.(event)\n if (!event.defaultPrevented) onDismiss?.()\n })\n\n const focusOutside = useFocusOutside((event) => {\n const target = event.target as HTMLDivElement\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target))\n if (isFocusInBranch) return\n onFocusOutside?.(event)\n onInteractOutside?.(event)\n if (!event.defaultPrevented) onDismiss?.()\n })\n\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1\n if (!isHighestLayer) return\n onEscapeKeyDown?.(event)\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault()\n onDismiss()\n }\n })\n\n React.useEffect(() => {\n if (!node) return\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = document.body.style.pointerEvents\n document.body.style.pointerEvents = 'none'\n }\n context.layersWithOutsidePointerEventsDisabled.add(node)\n }\n context.layers.add(node)\n dispatchUpdate()\n return () => {\n if (\n disableOutsidePointerEvents &&\n context.layersWithOutsidePointerEventsDisabled.size === 1\n ) {\n document.body.style.pointerEvents = originalBodyPointerEvents\n }\n }\n }, [node, disableOutsidePointerEvents, context])\n\n /**\n * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect\n * because a change to `disableOutsidePointerEvents` would remove this layer from the stack\n * and add it to the end again so the layering order wouldn't be _creation order_.\n * We only want them to be removed from context stacks when unmounted.\n */\n React.useEffect(() => {\n return () => {\n if (!node) return\n context.layers.delete(node)\n context.layersWithOutsidePointerEventsDisabled.delete(node)\n dispatchUpdate()\n }\n }, [node, context])\n\n React.useEffect(() => {\n const handleUpdate = () => force({})\n document.addEventListener(CONTEXT_UPDATE, handleUpdate)\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate)\n }, [])\n\n return (\n <div\n {...layerProps}\n // @ts-ignore\n ref={composedRefs}\n style={{\n display: 'contents',\n pointerEvents: isBodyPointerEventsDisabled\n ? isPointerEventsEnabled\n ? 'auto'\n : 'none'\n : undefined,\n // @ts-ignore\n ...props.style,\n }}\n onFocusCapture={composeEventHandlers(\n // @ts-ignore\n props.onFocusCapture,\n focusOutside.onFocusCapture\n )}\n onBlurCapture={composeEventHandlers(\n // @ts-ignore\n props.onBlurCapture,\n focusOutside.onBlurCapture\n )}\n // @ts-ignore\n onPointerDownCapture={composeEventHandlers(\n // @ts-ignore\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )}\n />\n )\n})\n\nDismissable.displayName = DISMISSABLE_LAYER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableBranch\n * -----------------------------------------------------------------------------------------------*/\n\nconst BRANCH_NAME = 'DismissableBranch'\n\nconst DismissableBranch = React.forwardRef<HTMLDivElement, DismissableBranchProps>(\n (props, forwardedRef) => {\n const context = React.useContext(DismissableContext)\n const ref = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n\n React.useEffect(() => {\n const node = ref.current\n if (node) {\n context.branches.add(node)\n return () => {\n context.branches.delete(node)\n }\n }\n }, [context.branches])\n\n return <div style={{ display: 'contents' }} {...props} ref={composedRefs} />\n }\n)\n\nDismissableBranch.displayName = BRANCH_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport type PointerDownOutsideEvent = CustomEvent<{ originalEvent: PointerEvent }>\nexport type FocusOutsideEvent = CustomEvent<{ originalEvent: FocusEvent }>\n\n/**\n * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`\n * to mimic layer dismissing behaviour present in OS.\n * Returns props to pass to the node we want to check for outside events.\n */\nfunction usePointerDownOutside(onPointerDownOutside?: (event: PointerDownOutsideEvent) => void) {\n const handlePointerDownOutside = useEvent(onPointerDownOutside) as EventListener\n const isPointerInsideReactTreeRef = React.useRef(false)\n const handleClickRef = React.useRef(() => {})\n\n React.useEffect(() => {\n const handlePointerDown = (event: PointerEvent) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event }\n\n function handleAndDispatchPointerDownOutsideEvent() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n )\n }\n\n /**\n * On touch devices, we need to wait for a click event because browsers implement\n * a ~350ms delay between the time the user stops touching the display and when the\n * browser executres events. We need to ensure we don't reactivate pointer-events within\n * this timeframe otherwise the browser may execute events that should have been prevented.\n *\n * Additionally, this also lets us deal automatically with cancellations when a click event\n * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.\n *\n * This is why we also continuously remove the previous listener, because we cannot be\n * certain that it was raised, and therefore cleaned-up.\n */\n if (event.pointerType === 'touch') {\n document.removeEventListener('click', handleClickRef.current)\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent\n document.addEventListener('click', handleClickRef.current, { once: true })\n } else {\n handleAndDispatchPointerDownOutsideEvent()\n }\n }\n isPointerInsideReactTreeRef.current = false\n }\n /**\n * if this hook executes in a component that mounts via a `pointerdown` event, the event\n * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n * this by delaying the event listener registration on the document.\n * This is not React specific, but rather how the DOM works, ie:\n * ```\n * button.addEventListener('pointerdown', () => {\n * console.log('I will log');\n * document.addEventListener('pointerdown', () => {\n * console.log('I will also log');\n * })\n * });\n */\n const timerId = window.setTimeout(() => {\n document.addEventListener('pointerdown', handlePointerDown)\n }, 0)\n return () => {\n window.clearTimeout(timerId)\n document.removeEventListener('pointerdown', handlePointerDown)\n document.removeEventListener('click', handleClickRef.current)\n }\n }, [handlePointerDownOutside])\n\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => (isPointerInsideReactTreeRef.current = true),\n }\n}\n\n/**\n * Listens for when focus happens outside a react subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */\nfunction useFocusOutside(onFocusOutside?: (event: FocusOutsideEvent) => void) {\n const handleFocusOutside = useEvent(onFocusOutside) as EventListener\n const isFocusInsideReactTreeRef = React.useRef(false)\n\n React.useEffect(() => {\n const handleFocus = (event: FocusEvent) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event }\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false,\n })\n }\n }\n document.addEventListener('focusin', handleFocus)\n return () => document.removeEventListener('focusin', handleFocus)\n }, [handleFocusOutside])\n\n return {\n onFocusCapture: () => (isFocusInsideReactTreeRef.current = true),\n onBlurCapture: () => (isFocusInsideReactTreeRef.current = false),\n }\n}\n\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE)\n document.dispatchEvent(event)\n}\n\nfunction handleAndDispatchCustomEvent<E extends CustomEvent, OriginalEvent extends Event>(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: OriginalEvent } & (E extends CustomEvent<infer D> ? D : never),\n { discrete }: { discrete: boolean }\n) {\n const target = detail.originalEvent.target\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail })\n if (handler) target.addEventListener(name, handler as EventListener, { once: true })\n\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event)\n } else {\n target.dispatchEvent(event)\n }\n}\n\nconst Root = Dismissable\nconst Branch = DismissableBranch\n\nexport {\n Dismissable,\n DismissableBranch,\n //\n Root,\n Branch,\n}\n\nexport type { DismissableProps }\n"],
|
|
5
|
-
"mappings": "AAGA;AACA;AACA;AACA;AACA;AACA;AAIA,qCAA4D,QAAqB,OAAU;AACzF,MAAI;AAAQ,aAAS,UAAU,MAAM,OAAO,cAAc,KAAK,CAAC;AAClE;AAMA,MAAM,yBAAyB;AAC/B,MAAM,iBAAiB;AACvB,MAAM,uBAAuB;AAC7B,MAAM,gBAAgB;AAEtB,IAAI;AAEJ,MAAM,qBAAqB,MAAM,cAAc;AAAA,EAC7C,QAAQ,oBAAI,IAAoB;AAAA,EAChC,wCAAwC,oBAAI,IAAoB;AAAA,EAChE,UAAU,oBAAI,IAAoB;AACpC,CAAC;AAED,MAAM,cAAc,MAAM,WAA6C,C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AAO;AACb,MAAM,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/dismissable",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.111",
|
|
4
4
|
"sideEffects": true,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@radix-ui/react-use-escape-keydown": "^0.1.0",
|
|
23
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
24
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
25
|
-
"@tamagui/use-event": "^1.0.1-beta.
|
|
23
|
+
"@tamagui/compose-refs": "^1.0.1-beta.111",
|
|
24
|
+
"@tamagui/core": "^1.0.1-beta.111",
|
|
25
|
+
"@tamagui/use-event": "^1.0.1-beta.111"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "*",
|
|
29
29
|
"react-dom": "*"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
32
|
+
"@tamagui/build": "^1.0.1-beta.111",
|
|
33
33
|
"react": "*",
|
|
34
34
|
"react-dom": "*"
|
|
35
35
|
},
|