@hanzogui/dismissable 7.0.0 → 7.3.0

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.
Files changed (45) hide show
  1. package/LICENSE +40 -19
  2. package/dist/cjs/Dismissable.cjs +383 -0
  3. package/dist/cjs/Dismissable.native.js +67 -0
  4. package/dist/cjs/Dismissable.native.js.map +1 -0
  5. package/dist/cjs/DismissableProps.cjs +18 -0
  6. package/dist/cjs/DismissableProps.native.js +21 -0
  7. package/dist/cjs/DismissableProps.native.js.map +1 -0
  8. package/dist/cjs/index.cjs +20 -0
  9. package/dist/cjs/index.native.js +23 -0
  10. package/dist/cjs/index.native.js.map +1 -0
  11. package/dist/esm/Dismissable.mjs +340 -0
  12. package/dist/esm/Dismissable.mjs.map +1 -0
  13. package/dist/esm/Dismissable.native.js +22 -0
  14. package/dist/esm/Dismissable.native.js.map +1 -0
  15. package/dist/esm/DismissableProps.mjs +2 -0
  16. package/dist/esm/DismissableProps.mjs.map +1 -0
  17. package/dist/esm/DismissableProps.native.js +2 -0
  18. package/dist/esm/DismissableProps.native.js.map +1 -0
  19. package/dist/esm/index.js +2 -0
  20. package/dist/esm/index.js.map +1 -0
  21. package/dist/esm/index.mjs +2 -0
  22. package/dist/esm/index.mjs.map +1 -0
  23. package/dist/esm/index.native.js +2 -0
  24. package/dist/esm/index.native.js.map +1 -0
  25. package/dist/jsx/Dismissable.mjs +340 -0
  26. package/dist/jsx/Dismissable.mjs.map +1 -0
  27. package/dist/jsx/Dismissable.native.js +67 -0
  28. package/dist/jsx/Dismissable.native.js.map +1 -0
  29. package/dist/jsx/DismissableProps.mjs +2 -0
  30. package/dist/jsx/DismissableProps.mjs.map +1 -0
  31. package/dist/jsx/DismissableProps.native.js +21 -0
  32. package/dist/jsx/DismissableProps.native.js.map +1 -0
  33. package/dist/jsx/index.js +2 -0
  34. package/dist/jsx/index.js.map +1 -0
  35. package/dist/jsx/index.mjs +2 -0
  36. package/dist/jsx/index.mjs.map +1 -0
  37. package/dist/jsx/index.native.js +23 -0
  38. package/dist/jsx/index.native.js.map +1 -0
  39. package/package.json +15 -13
  40. package/src/Dismissable.tsx +3 -3
  41. package/types/Dismissable.d.ts +2 -2
  42. package/types/Dismissable.d.ts.map +1 -0
  43. package/types/Dismissable.native.d.ts.map +1 -0
  44. package/types/DismissableProps.d.ts.map +1 -0
  45. package/types/index.d.ts.map +1 -0
package/LICENSE CHANGED
@@ -1,21 +1,42 @@
1
- MIT License
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026-present, Hanzo AI, Inc.
4
+
5
+ Portions of this software are derived from upstream code originally licensed under
6
+ the MIT License, with the following copyright notices retained per its terms:
2
7
 
3
8
  Copyright (c) 2020 Nate Wienert
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
9
+ Copyright (c) 2015-present, Nicolas Gallagher.
10
+ Copyright (c) 2015-present, Facebook, Inc.
11
+ Copyright (c) 2021 Radix
12
+ Copyright (c) 2017 Carmelo Pullara
13
+ Copyright (c) 2018 Framer B.V.
14
+ Copyright (c) 2022 WorkOS
15
+
16
+ All rights reserved.
17
+
18
+ Redistribution and use in source and binary forms, with or without
19
+ modification, are permitted provided that the following conditions are met:
20
+
21
+ 1. Redistributions of source code must retain the above copyright notice, this
22
+ list of conditions and the following disclaimer.
23
+
24
+ 2. Redistributions in binary form must reproduce the above copyright notice,
25
+ this list of conditions and the following disclaimer in the documentation
26
+ and/or other materials provided with the distribution.
27
+
28
+ 3. Neither the name of the copyright holder nor the names of its contributors
29
+ may be used to endorse or promote products derived from this software
30
+ without specific prior written permission.
31
+
32
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
36
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42
+ POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,383 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var Dismissable_exports = {};
35
+ __export(Dismissable_exports, {
36
+ Dismissable: () => Dismissable,
37
+ DismissableBranch: () => DismissableBranch,
38
+ debugDismissableLayers: () => debugDismissableLayers,
39
+ dispatchDiscreteCustomEvent: () => dispatchDiscreteCustomEvent,
40
+ getDismissableLayerCount: () => getDismissableLayerCount,
41
+ useDismissableLayersAbove: () => useDismissableLayersAbove,
42
+ useHasDismissableLayers: () => useHasDismissableLayers,
43
+ useIsInsideDismissable: () => useIsInsideDismissable
44
+ });
45
+ module.exports = __toCommonJS(Dismissable_exports);
46
+ var import_compose_refs = require("@hanzogui/compose-refs");
47
+ var import_core = require("@hanzogui/core");
48
+ var import_use_escape_keydown = require("@hanzogui/use-escape-keydown");
49
+ var import_use_event = require("@hanzogui/use-event");
50
+ var React = __toESM(require("react"), 1);
51
+ var ReactDOM = __toESM(require("react-dom"), 1);
52
+ var import_jsx_runtime = require("react/jsx-runtime");
53
+ function dispatchDiscreteCustomEvent(target, event) {
54
+ if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
55
+ }
56
+ const DISMISSABLE_LAYER_NAME = "Dismissable";
57
+ const CONTEXT_UPDATE = "dismissable.update";
58
+ const POINTER_DOWN_OUTSIDE = "dismissable.pointerDownOutside";
59
+ const FOCUS_OUTSIDE = "dismissable.focusOutside";
60
+ let originalBodyPointerEvents;
61
+ const globalLayers = /* @__PURE__ */new Set();
62
+ const layerChangeListeners = /* @__PURE__ */new Set();
63
+ let layersWithPointerEventsDisabledCount = 0;
64
+ function notifyLayerChange() {
65
+ for (const listener of layerChangeListeners) {
66
+ listener();
67
+ }
68
+ }
69
+ function getDismissableLayerCount() {
70
+ return globalLayers.size;
71
+ }
72
+ function debugDismissableLayers() {
73
+ const layers = Array.from(globalLayers);
74
+ console.log("[Dismissable] Active layers:", layers.length, layers);
75
+ return layers;
76
+ }
77
+ function useHasDismissableLayers() {
78
+ const [count, setCount] = React.useState(() => globalLayers.size);
79
+ React.useEffect(() => {
80
+ setCount(globalLayers.size);
81
+ const update = () => setCount(globalLayers.size);
82
+ layerChangeListeners.add(update);
83
+ return () => {
84
+ layerChangeListeners.delete(update);
85
+ };
86
+ }, []);
87
+ return count > 0;
88
+ }
89
+ const DismissableContext = React.createContext({
90
+ layers: /* @__PURE__ */new Set(),
91
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */new Set(),
92
+ branches: /* @__PURE__ */new Set()
93
+ });
94
+ function useIsInsideDismissable(ref) {
95
+ const context = React.useContext(DismissableContext);
96
+ const [isInside, setIsInside] = React.useState(false);
97
+ React.useEffect(() => {
98
+ const check = () => {
99
+ const el = ref.current;
100
+ if (!el) {
101
+ setIsInside(false);
102
+ return;
103
+ }
104
+ for (const layer of context.layers) {
105
+ if (layer.contains(el)) {
106
+ setIsInside(true);
107
+ return;
108
+ }
109
+ }
110
+ setIsInside(false);
111
+ };
112
+ check();
113
+ document.addEventListener(CONTEXT_UPDATE, check);
114
+ return () => document.removeEventListener(CONTEXT_UPDATE, check);
115
+ }, [context.layers, ref]);
116
+ return isInside;
117
+ }
118
+ function useDismissableLayersAbove(ref) {
119
+ const context = React.useContext(DismissableContext);
120
+ const [count, setCount] = React.useState(0);
121
+ React.useEffect(() => {
122
+ const check = () => {
123
+ const el = ref.current;
124
+ if (!el) {
125
+ setCount(0);
126
+ return;
127
+ }
128
+ let above = 0;
129
+ for (const layer of context.layers) {
130
+ if (layer.contains(el)) {
131
+ above++;
132
+ }
133
+ }
134
+ setCount(above);
135
+ };
136
+ check();
137
+ document.addEventListener(CONTEXT_UPDATE, check);
138
+ return () => document.removeEventListener(CONTEXT_UPDATE, check);
139
+ }, [context.layers, ref]);
140
+ return count;
141
+ }
142
+ const Dismissable = React.forwardRef((props, forwardedRef) => {
143
+ const {
144
+ disableOutsidePointerEvents = false,
145
+ forceUnmount,
146
+ onEscapeKeyDown,
147
+ onPointerDownOutside,
148
+ onFocusOutside,
149
+ onInteractOutside,
150
+ onDismiss,
151
+ asChild,
152
+ children,
153
+ branches: branchesProp,
154
+ ...layerProps
155
+ } = props;
156
+ const Comp = asChild ? import_core.Slot : import_core.View;
157
+ const context = React.useContext(DismissableContext);
158
+ const [node, setNode] = React.useState(null);
159
+ const [, force] = React.useState({});
160
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, node2 => setNode(node2));
161
+ const layers = Array.from(context.layers);
162
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
163
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
164
+ const index = node ? layers.indexOf(node) : -1;
165
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
166
+ const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
167
+ const pointerDownOutside = usePointerDownOutside(event => {
168
+ const target = event.target;
169
+ const branches = branchesProp || context.branches;
170
+ const isPointerDownOnBranch = [...branches].some(branch => branch.contains(target));
171
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
172
+ onPointerDownOutside?.(event);
173
+ onInteractOutside?.(event);
174
+ if (!event.defaultPrevented) onDismiss?.();
175
+ });
176
+ const focusOutside = useFocusOutside(event => {
177
+ const target = event.target;
178
+ const branches = branchesProp || context.branches;
179
+ const isFocusInBranch = [...branches].some(branch => branch.contains(target));
180
+ if (isFocusInBranch) return;
181
+ onFocusOutside?.(event);
182
+ onInteractOutside?.(event);
183
+ if (!event.defaultPrevented) onDismiss?.();
184
+ });
185
+ const forceUnmountRef = React.useRef(forceUnmount);
186
+ React.useEffect(() => {
187
+ forceUnmountRef.current = forceUnmount;
188
+ }, [forceUnmount]);
189
+ (0, import_use_escape_keydown.useEscapeKeydown)(event => {
190
+ if (forceUnmountRef.current) return;
191
+ const currentLayers = Array.from(context.layers);
192
+ const currentIndex = node ? currentLayers.indexOf(node) : -1;
193
+ const isHighestLayer = currentIndex === currentLayers.length - 1;
194
+ if (!isHighestLayer) return;
195
+ onEscapeKeyDown?.(event);
196
+ if (!event.defaultPrevented && onDismiss) {
197
+ event.preventDefault();
198
+ onDismiss();
199
+ }
200
+ });
201
+ React.useEffect(() => {
202
+ if (!node) return;
203
+ if (forceUnmount) return;
204
+ if (disableOutsidePointerEvents) {
205
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
206
+ originalBodyPointerEvents = document.body.style.pointerEvents;
207
+ document.body.style.pointerEvents = "none";
208
+ }
209
+ context.layersWithOutsidePointerEventsDisabled.add(node);
210
+ layersWithPointerEventsDisabledCount++;
211
+ }
212
+ context.layers.add(node);
213
+ globalLayers.add(node);
214
+ if (disableOutsidePointerEvents || layersWithPointerEventsDisabledCount > 0) {
215
+ dispatchUpdate();
216
+ }
217
+ notifyLayerChange();
218
+ return () => {
219
+ if (disableOutsidePointerEvents) {
220
+ if (context.layersWithOutsidePointerEventsDisabled.size === 1) {
221
+ document.body.style.pointerEvents = originalBodyPointerEvents;
222
+ }
223
+ }
224
+ };
225
+ }, [node, disableOutsidePointerEvents, forceUnmount, context]);
226
+ React.useEffect(() => {
227
+ if (forceUnmount) return;
228
+ return () => {
229
+ if (!node) return;
230
+ const hadPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.has(node);
231
+ context.layers.delete(node);
232
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
233
+ globalLayers.delete(node);
234
+ if (layersWithPointerEventsDisabledCount > 0) {
235
+ dispatchUpdate();
236
+ }
237
+ notifyLayerChange();
238
+ if (hadPointerEventsDisabled) {
239
+ layersWithPointerEventsDisabledCount--;
240
+ }
241
+ };
242
+ }, [node, context, forceUnmount]);
243
+ React.useEffect(() => {
244
+ const handleUpdate = () => {
245
+ if (layersWithPointerEventsDisabledCount > 0) {
246
+ force({});
247
+ }
248
+ };
249
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
250
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
251
+ }, []);
252
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Comp, {
253
+ ...layerProps,
254
+ ref: composedRefs,
255
+ ...(!asChild && {
256
+ display: "contents"
257
+ }),
258
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
259
+ onFocusCapture: (0, import_core.composeEventHandlers)(props.onFocusCapture, focusOutside.onFocusCapture),
260
+ onBlurCapture: (0, import_core.composeEventHandlers)(props.onBlurCapture, focusOutside.onBlurCapture),
261
+ onPointerDownCapture: (0, import_core.composeEventHandlers)(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture),
262
+ children
263
+ });
264
+ });
265
+ Dismissable.displayName = DISMISSABLE_LAYER_NAME;
266
+ const BRANCH_NAME = "DismissableBranch";
267
+ const DismissableBranch = React.forwardRef((props, forwardedRef) => {
268
+ const {
269
+ branches: branchesProp,
270
+ ...rest
271
+ } = props;
272
+ const context = React.useContext(DismissableContext);
273
+ const ref = React.useRef(null);
274
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
275
+ React.useEffect(() => {
276
+ const node = ref.current;
277
+ if (!(node instanceof HTMLElement)) return;
278
+ const branches = branchesProp || context.branches;
279
+ if (node && branches) {
280
+ branches.add(node);
281
+ return () => {
282
+ branches.delete(node);
283
+ };
284
+ }
285
+ }, [branchesProp, context.branches]);
286
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.View, {
287
+ asChild: "except-style",
288
+ ...rest,
289
+ ref: composedRefs
290
+ });
291
+ });
292
+ DismissableBranch.displayName = BRANCH_NAME;
293
+ function usePointerDownOutside(onPointerDownOutside) {
294
+ const handlePointerDownOutside = (0, import_use_event.useEvent)(onPointerDownOutside);
295
+ const isPointerInsideReactTreeRef = React.useRef(false);
296
+ const handleClickRef = React.useRef(() => {});
297
+ React.useEffect(() => {
298
+ const handlePointerDown = event => {
299
+ if (event.target && !isPointerInsideReactTreeRef.current) {
300
+ let handleAndDispatchPointerDownOutsideEvent = function () {
301
+ handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
302
+ discrete: true
303
+ });
304
+ };
305
+ const eventDetail = {
306
+ originalEvent: event
307
+ };
308
+ if (event.pointerType === "touch") {
309
+ document.removeEventListener("click", handleClickRef.current);
310
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
311
+ document.addEventListener("click", handleClickRef.current, {
312
+ once: true
313
+ });
314
+ } else {
315
+ handleAndDispatchPointerDownOutsideEvent();
316
+ }
317
+ }
318
+ isPointerInsideReactTreeRef.current = false;
319
+ };
320
+ const timerId = setTimeout(() => {
321
+ document.addEventListener("pointerdown", handlePointerDown);
322
+ }, 0);
323
+ return () => {
324
+ window.clearTimeout(timerId);
325
+ document.removeEventListener("pointerdown", handlePointerDown);
326
+ document.removeEventListener("click", handleClickRef.current);
327
+ };
328
+ }, [handlePointerDownOutside]);
329
+ return {
330
+ // ensures we check React component tree (not just DOM tree)
331
+ onPointerDownCapture: () => {
332
+ isPointerInsideReactTreeRef.current = true;
333
+ }
334
+ };
335
+ }
336
+ function useFocusOutside(onFocusOutside) {
337
+ const handleFocusOutside = (0, import_use_event.useEvent)(onFocusOutside);
338
+ const isFocusInsideReactTreeRef = React.useRef(false);
339
+ React.useEffect(() => {
340
+ const handleFocus = event => {
341
+ if (event.target && !isFocusInsideReactTreeRef.current) {
342
+ const eventDetail = {
343
+ originalEvent: event
344
+ };
345
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
346
+ discrete: false
347
+ });
348
+ }
349
+ };
350
+ document.addEventListener("focusin", handleFocus);
351
+ return () => document.removeEventListener("focusin", handleFocus);
352
+ }, [handleFocusOutside]);
353
+ return {
354
+ onFocusCapture: () => {
355
+ isFocusInsideReactTreeRef.current = true;
356
+ },
357
+ onBlurCapture: () => {
358
+ isFocusInsideReactTreeRef.current = false;
359
+ }
360
+ };
361
+ }
362
+ function dispatchUpdate() {
363
+ const event = new CustomEvent(CONTEXT_UPDATE);
364
+ document.dispatchEvent(event);
365
+ }
366
+ function handleAndDispatchCustomEvent(name, handler, detail, {
367
+ discrete
368
+ }) {
369
+ const target = detail.originalEvent.target;
370
+ const event = new CustomEvent(name, {
371
+ bubbles: false,
372
+ cancelable: true,
373
+ detail
374
+ });
375
+ if (handler) target.addEventListener(name, handler, {
376
+ once: true
377
+ });
378
+ if (discrete) {
379
+ dispatchDiscreteCustomEvent(target, event);
380
+ } else {
381
+ target.dispatchEvent(event);
382
+ }
383
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
36
+ var Dismissable_native_exports = {};
37
+ __export(Dismissable_native_exports, {
38
+ Dismissable: () => Dismissable,
39
+ DismissableBranch: () => DismissableBranch,
40
+ dispatchDiscreteCustomEvent: () => dispatchDiscreteCustomEvent,
41
+ getDismissableLayerCount: () => getDismissableLayerCount,
42
+ useDismissableLayersAbove: () => useDismissableLayersAbove,
43
+ useHasDismissableLayers: () => useHasDismissableLayers,
44
+ useIsInsideDismissable: () => useIsInsideDismissable
45
+ });
46
+ module.exports = __toCommonJS(Dismissable_native_exports);
47
+ var import_react = __toESM(require("react"), 1);
48
+ function dispatchDiscreteCustomEvent(_target, _event) {}
49
+ function getDismissableLayerCount() {
50
+ return 0;
51
+ }
52
+ function useHasDismissableLayers() {
53
+ return false;
54
+ }
55
+ function useIsInsideDismissable(_ref) {
56
+ return false;
57
+ }
58
+ function useDismissableLayersAbove(_ref) {
59
+ return 0;
60
+ }
61
+ var Dismissable = /* @__PURE__ */import_react.default.forwardRef(function (props, _ref) {
62
+ return props.children;
63
+ });
64
+ var DismissableBranch = /* @__PURE__ */import_react.default.forwardRef(function (props, _ref) {
65
+ return props.children;
66
+ });
67
+ //# sourceMappingURL=Dismissable.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Dismissable_native_exports","__export","Dismissable","DismissableBranch","dispatchDiscreteCustomEvent","getDismissableLayerCount","useDismissableLayersAbove","useHasDismissableLayers","useIsInsideDismissable","module","exports","__toCommonJS","import_react","__toESM","require","_target","_event","_ref","default","forwardRef","props","children"],"sources":["../../src/Dismissable.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA,WAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAAC,2BAAA,EAAAA,CAAA,KAAAA,2BAAA;EAAAC,wBAAA,EAAAA,CAAA,KAAAA,wBAAA;EAAAC,yBAAA,EAAAA,CAAA,KAAAA,yBAAA;EAAAC,uBAAA,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,sBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAX,0BAAA;AAAA,IAAAY,YAAA,GAAkBC,OAAA,CAAAC,OAAA;AAEX,SAASV,4BAA4BW,OAAA,EAASC,MAAA,EAAQ,CAAC;AACvD,SAASX,yBAAA,EAA2B;EACvC,OAAO;AACX;AACO,SAASE,wBAAA,EAA0B;EACtC,OAAO;AACX;AACO,SAASC,uBAAuBS,IAAA,EAAM;EACzC,OAAO;AACX;AACO,SAASX,0BAA0BW,IAAA,EAAM;EAC5C,OAAO;AACX;AACO,IAAIf,WAAA,GAA4B,eAAAU,YAAA,CAAAM,OAAA,CAAMC,UAAA,CAAW,UAASC,KAAA,EAAOH,IAAA,EAAM;EAC1E,OAAOG,KAAA,CAAMC,QAAA;AACjB,CAAC;AACM,IAAIlB,iBAAA,GAAkC,eAAAS,YAAA,CAAAM,OAAA,CAAMC,UAAA,CAAW,UAASC,KAAA,EAAOH,IAAA,EAAM;EAChF,OAAOG,KAAA,CAAMC,QAAA;AACjB,CAAC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
+ value: true
16
+ }), mod);
17
+ var DismissableProps_exports = {};
18
+ module.exports = __toCommonJS(DismissableProps_exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
+ };
16
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
17
+ value: true
18
+ }), mod);
19
+ var DismissableProps_exports = {};
20
+ module.exports = __toCommonJS(DismissableProps_exports);
21
+ //# sourceMappingURL=DismissableProps.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__copyProps","to","from","except","desc","key","call","get","enumerable","__toCommonJS","mod","value","DismissableProps_exports","module","exports"],"sources":["DismissableProps.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar DismissableProps_exports = {};\nmodule.exports = __toCommonJS(DismissableProps_exports);\n//# sourceMappingURL=DismissableProps.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAAK,IAAIG,GAAG,IAAIV,iBAAiB,CAACO,IAAI,CAAC,EACrC,IAAI,CAACL,YAAY,CAACS,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAC/Cb,SAAS,CAACW,EAAE,EAAEI,GAAG,EAAE;MAAEE,GAAG,EAAEA,CAAA,KAAML,IAAI,CAACG,GAAG,CAAC;MAAEG,UAAU,EAAE,EAAEJ,IAAI,GAAGX,gBAAgB,CAACS,IAAI,EAAEG,GAAG,CAAC,CAAC,IAAID,IAAI,CAACI;IAAW,CAAC,CAAC;EACxH;EACA,OAAOP,EAAE;AACX,CAAC;AACD,IAAIQ,YAAY,GAAIC,GAAG,IAAKV,WAAW,CAACV,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE;EAAEqB,KAAK,EAAE;AAAK,CAAC,CAAC,EAAED,GAAG,CAAC;AAC1F,IAAIE,wBAAwB,GAAG,CAAC,CAAC;AACjCC,MAAM,CAACC,OAAO,GAAGL,YAAY,CAACG,wBAAwB,CAAC","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
+ value: true
17
+ }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./Dismissable.cjs"), module.exports);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
+ value: true
19
+ }), mod);
20
+ var index_exports = {};
21
+ module.exports = __toCommonJS(index_exports);
22
+ __reExport(index_exports, require("./Dismissable.native.js"), module.exports);
23
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__copyProps","to","from","except","desc","key","call","get","enumerable","__reExport","target","mod","secondTarget","__toCommonJS","value","index_exports","module","exports","require"],"sources":["index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./Dismissable\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAAK,IAAIG,GAAG,IAAIV,iBAAiB,CAACO,IAAI,CAAC,EACrC,IAAI,CAACL,YAAY,CAACS,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAC/Cb,SAAS,CAACW,EAAE,EAAEI,GAAG,EAAE;MAAEE,GAAG,EAAEA,CAAA,KAAML,IAAI,CAACG,GAAG,CAAC;MAAEG,UAAU,EAAE,EAAEJ,IAAI,GAAGX,gBAAgB,CAACS,IAAI,EAAEG,GAAG,CAAC,CAAC,IAAID,IAAI,CAACI;IAAW,CAAC,CAAC;EACxH;EACA,OAAOP,EAAE;AACX,CAAC;AACD,IAAIQ,UAAU,GAAGA,CAACC,MAAM,EAAEC,GAAG,EAAEC,YAAY,MAAMZ,WAAW,CAACU,MAAM,EAAEC,GAAG,EAAE,SAAS,CAAC,EAAEC,YAAY,IAAIZ,WAAW,CAACY,YAAY,EAAED,GAAG,EAAE,SAAS,CAAC,CAAC;AAChJ,IAAIE,YAAY,GAAIF,GAAG,IAAKX,WAAW,CAACV,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE;EAAEwB,KAAK,EAAE;AAAK,CAAC,CAAC,EAAEH,GAAG,CAAC;AAC1F,IAAII,aAAa,GAAG,CAAC,CAAC;AACtBC,MAAM,CAACC,OAAO,GAAGJ,YAAY,CAACE,aAAa,CAAC;AAC5CN,UAAU,CAACM,aAAa,EAAEG,OAAO,CAAC,yBAAe,CAAC,EAAEF,MAAM,CAACC,OAAO,CAAC","ignoreList":[]}