@tamagui/floating 2.7.7 → 3.0.0-beta.1093.1

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 (155) hide show
  1. package/dist/cjs/Floating.cjs +9 -11
  2. package/dist/cjs/Floating.native.cjs +36 -0
  3. package/dist/cjs/Floating.native.js +19 -20
  4. package/dist/cjs/Floating.native.js.map +1 -1
  5. package/dist/cjs/index.cjs +44 -46
  6. package/dist/cjs/index.native.cjs +73 -0
  7. package/dist/cjs/index.native.js +44 -45
  8. package/dist/cjs/index.native.js.map +1 -1
  9. package/dist/cjs/interactions/PopupTriggerMap.cjs +35 -39
  10. package/dist/cjs/interactions/PopupTriggerMap.native.cjs +95 -0
  11. package/dist/cjs/interactions/PopupTriggerMap.native.js +75 -75
  12. package/dist/cjs/interactions/PopupTriggerMap.native.js.map +1 -1
  13. package/dist/cjs/interactions/createFloatingEvents.cjs +35 -39
  14. package/dist/cjs/interactions/createFloatingEvents.native.cjs +51 -0
  15. package/dist/cjs/interactions/createFloatingEvents.native.js +38 -41
  16. package/dist/cjs/interactions/createFloatingEvents.native.js.map +1 -1
  17. package/dist/cjs/interactions/safePolygon.cjs +262 -252
  18. package/dist/cjs/interactions/safePolygon.native.cjs +293 -0
  19. package/dist/cjs/interactions/safePolygon.native.js +270 -259
  20. package/dist/cjs/interactions/safePolygon.native.js.map +1 -1
  21. package/dist/cjs/interactions/types.cjs +9 -11
  22. package/dist/cjs/interactions/types.native.cjs +18 -0
  23. package/dist/cjs/interactions/types.native.js +9 -10
  24. package/dist/cjs/interactions/types.native.js.map +1 -1
  25. package/dist/cjs/interactions/useClick.cjs +95 -105
  26. package/dist/cjs/interactions/useClick.native.cjs +121 -0
  27. package/dist/cjs/interactions/useClick.native.js +100 -109
  28. package/dist/cjs/interactions/useClick.native.js.map +1 -1
  29. package/dist/cjs/interactions/useDelayGroup.cjs +85 -91
  30. package/dist/cjs/interactions/useDelayGroup.native.cjs +118 -0
  31. package/dist/cjs/interactions/useDelayGroup.native.js +91 -96
  32. package/dist/cjs/interactions/useDelayGroup.native.js.map +1 -1
  33. package/dist/cjs/interactions/useFocus.cjs +107 -115
  34. package/dist/cjs/interactions/useFocus.native.cjs +130 -0
  35. package/dist/cjs/interactions/useFocus.native.js +113 -120
  36. package/dist/cjs/interactions/useFocus.native.js.map +1 -1
  37. package/dist/cjs/interactions/useHover.cjs +320 -335
  38. package/dist/cjs/interactions/useHover.native.cjs +356 -0
  39. package/dist/cjs/interactions/useHover.native.js +332 -347
  40. package/dist/cjs/interactions/useHover.native.js.map +1 -1
  41. package/dist/cjs/interactions/useInnerOffset.cjs +102 -111
  42. package/dist/cjs/interactions/useInnerOffset.native.cjs +131 -0
  43. package/dist/cjs/interactions/useInnerOffset.native.js +112 -120
  44. package/dist/cjs/interactions/useInnerOffset.native.js.map +1 -1
  45. package/dist/cjs/interactions/useInteractions.cjs +76 -92
  46. package/dist/cjs/interactions/useInteractions.native.cjs +199 -0
  47. package/dist/cjs/interactions/useInteractions.native.js +185 -200
  48. package/dist/cjs/interactions/useInteractions.native.js.map +1 -1
  49. package/dist/cjs/interactions/useListNavigation.cjs +404 -390
  50. package/dist/cjs/interactions/useListNavigation.native.cjs +446 -0
  51. package/dist/cjs/interactions/useListNavigation.native.js +416 -401
  52. package/dist/cjs/interactions/useListNavigation.native.js.map +1 -1
  53. package/dist/cjs/interactions/useRole.cjs +91 -106
  54. package/dist/cjs/interactions/useRole.native.cjs +120 -0
  55. package/dist/cjs/interactions/useRole.native.js +102 -116
  56. package/dist/cjs/interactions/useRole.native.js.map +1 -1
  57. package/dist/cjs/interactions/useTypeahead.cjs +114 -129
  58. package/dist/cjs/interactions/useTypeahead.native.cjs +143 -0
  59. package/dist/cjs/interactions/useTypeahead.native.js +127 -141
  60. package/dist/cjs/interactions/useTypeahead.native.js.map +1 -1
  61. package/dist/cjs/interactions/utils.cjs +125 -143
  62. package/dist/cjs/interactions/utils.native.cjs +201 -0
  63. package/dist/cjs/interactions/utils.native.js +132 -156
  64. package/dist/cjs/interactions/utils.native.js.map +1 -1
  65. package/dist/cjs/middleware/inner.cjs +73 -101
  66. package/dist/cjs/middleware/inner.native.cjs +101 -0
  67. package/dist/cjs/middleware/inner.native.js +82 -109
  68. package/dist/cjs/middleware/inner.native.js.map +1 -1
  69. package/dist/cjs/useFloating.cjs +33 -46
  70. package/dist/cjs/useFloating.native.cjs +55 -0
  71. package/dist/cjs/useFloating.native.js +36 -48
  72. package/dist/cjs/useFloating.native.js.map +1 -1
  73. package/dist/esm/Floating.mjs +1 -2
  74. package/dist/esm/Floating.native.js +6 -4
  75. package/dist/esm/Floating.native.js.map +1 -1
  76. package/dist/esm/index.js +4 -5
  77. package/dist/esm/index.mjs +4 -5
  78. package/dist/esm/index.native.js +4 -5
  79. package/dist/esm/interactions/PopupTriggerMap.mjs +23 -22
  80. package/dist/esm/interactions/PopupTriggerMap.mjs.map +1 -1
  81. package/dist/esm/interactions/PopupTriggerMap.native.js +62 -58
  82. package/dist/esm/interactions/PopupTriggerMap.native.js.map +1 -1
  83. package/dist/esm/interactions/createFloatingEvents.mjs +22 -21
  84. package/dist/esm/interactions/createFloatingEvents.mjs.map +1 -1
  85. package/dist/esm/interactions/createFloatingEvents.native.js +25 -24
  86. package/dist/esm/interactions/createFloatingEvents.native.js.map +1 -1
  87. package/dist/esm/interactions/safePolygon.mjs +250 -234
  88. package/dist/esm/interactions/safePolygon.mjs.map +1 -1
  89. package/dist/esm/interactions/safePolygon.native.js +258 -242
  90. package/dist/esm/interactions/safePolygon.native.js.map +1 -1
  91. package/dist/esm/interactions/types.mjs +0 -2
  92. package/dist/esm/interactions/types.native.js +0 -2
  93. package/dist/esm/interactions/useClick.mjs +83 -87
  94. package/dist/esm/interactions/useClick.mjs.map +1 -1
  95. package/dist/esm/interactions/useClick.native.js +88 -92
  96. package/dist/esm/interactions/useClick.native.js.map +1 -1
  97. package/dist/esm/interactions/useDelayGroup.mjs +68 -65
  98. package/dist/esm/interactions/useDelayGroup.mjs.map +1 -1
  99. package/dist/esm/interactions/useDelayGroup.native.js +74 -71
  100. package/dist/esm/interactions/useDelayGroup.native.js.map +1 -1
  101. package/dist/esm/interactions/useFocus.mjs +95 -97
  102. package/dist/esm/interactions/useFocus.mjs.map +1 -1
  103. package/dist/esm/interactions/useFocus.native.js +101 -103
  104. package/dist/esm/interactions/useFocus.native.js.map +1 -1
  105. package/dist/esm/interactions/useHover.mjs +304 -310
  106. package/dist/esm/interactions/useHover.mjs.map +1 -1
  107. package/dist/esm/interactions/useHover.native.js +316 -323
  108. package/dist/esm/interactions/useHover.native.js.map +1 -1
  109. package/dist/esm/interactions/useInnerOffset.mjs +87 -85
  110. package/dist/esm/interactions/useInnerOffset.mjs.map +1 -1
  111. package/dist/esm/interactions/useInnerOffset.native.js +97 -95
  112. package/dist/esm/interactions/useInnerOffset.native.js.map +1 -1
  113. package/dist/esm/interactions/useInteractions.mjs +65 -75
  114. package/dist/esm/interactions/useInteractions.mjs.map +1 -1
  115. package/dist/esm/interactions/useInteractions.native.js +172 -182
  116. package/dist/esm/interactions/useInteractions.native.js.map +1 -1
  117. package/dist/esm/interactions/useListNavigation.mjs +393 -373
  118. package/dist/esm/interactions/useListNavigation.mjs.map +1 -1
  119. package/dist/esm/interactions/useListNavigation.native.js +405 -385
  120. package/dist/esm/interactions/useListNavigation.native.js.map +1 -1
  121. package/dist/esm/interactions/useRole.mjs +76 -80
  122. package/dist/esm/interactions/useRole.mjs.map +1 -1
  123. package/dist/esm/interactions/useRole.native.js +87 -91
  124. package/dist/esm/interactions/useRole.native.js.map +1 -1
  125. package/dist/esm/interactions/useTypeahead.mjs +102 -111
  126. package/dist/esm/interactions/useTypeahead.mjs.map +1 -1
  127. package/dist/esm/interactions/useTypeahead.native.js +115 -124
  128. package/dist/esm/interactions/useTypeahead.native.js.map +1 -1
  129. package/dist/esm/interactions/utils.mjs +91 -106
  130. package/dist/esm/interactions/utils.mjs.map +1 -1
  131. package/dist/esm/interactions/utils.native.js +98 -120
  132. package/dist/esm/interactions/utils.native.js.map +1 -1
  133. package/dist/esm/middleware/inner.mjs +58 -75
  134. package/dist/esm/middleware/inner.mjs.map +1 -1
  135. package/dist/esm/middleware/inner.native.js +67 -84
  136. package/dist/esm/middleware/inner.native.js.map +1 -1
  137. package/dist/esm/useFloating.mjs +17 -21
  138. package/dist/esm/useFloating.mjs.map +1 -1
  139. package/dist/esm/useFloating.native.js +19 -23
  140. package/dist/esm/useFloating.native.js.map +1 -1
  141. package/package.json +8 -6
  142. package/src/interactions/useInteractions.ts +61 -59
  143. package/src/interactions/useListNavigation.ts +7 -2
  144. package/types/interactions/PopupTriggerMap.d.ts.map +1 -1
  145. package/types/interactions/useInteractions.d.ts +3 -3
  146. package/types/interactions/useInteractions.d.ts.map +1 -1
  147. package/types/interactions/useListNavigation.d.ts.map +1 -1
  148. package/types/middleware/inner.d.ts.map +1 -1
  149. package/types/useFloating.d.ts.map +1 -1
  150. package/dist/esm/Floating.mjs.map +0 -1
  151. package/dist/esm/index.js.map +0 -1
  152. package/dist/esm/index.mjs.map +0 -1
  153. package/dist/esm/index.native.js.map +0 -1
  154. package/dist/esm/interactions/types.mjs.map +0 -1
  155. package/dist/esm/interactions/types.native.js.map +0 -1
@@ -7,119 +7,114 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
14
  };
15
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;
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
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
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
32
27
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
29
  var useDelayGroup_exports = {};
37
30
  __export(useDelayGroup_exports, {
38
- FloatingDelayGroup: () => FloatingDelayGroup,
39
- useDelayGroup: () => useDelayGroup,
40
- useDelayGroupContext: () => useDelayGroupContext
31
+ FloatingDelayGroup: () => FloatingDelayGroup,
32
+ useDelayGroup: () => useDelayGroup,
33
+ useDelayGroupContext: () => useDelayGroupContext
41
34
  });
42
35
  module.exports = __toCommonJS(useDelayGroup_exports);
43
36
  var React = __toESM(require("react"), 1);
44
37
  var DelayGroupContext = React.createContext({
45
- currentId: null,
46
- setCurrentId: function () {},
47
- delay: 0,
48
- timeoutMs: 0,
49
- initialDelay: 0
38
+ currentId: null,
39
+ setCurrentId: function() {},
40
+ delay: 0,
41
+ timeoutMs: 0,
42
+ initialDelay: 0
50
43
  });
51
44
  function useDelayGroupContext() {
52
- return React.useContext(DelayGroupContext);
45
+ return React.useContext(DelayGroupContext);
53
46
  }
54
47
  function FloatingDelayGroup(param) {
55
- var {
56
- children,
57
- delay,
58
- timeoutMs = 0
59
- } = param;
60
- var [currentId, setCurrentIdRaw] = React.useState(null);
61
- var timeoutRef = React.useRef(void 0);
62
- var setCurrentId = React.useCallback(function (id) {
63
- clearTimeout(timeoutRef.current);
64
- if (id == null && timeoutMs > 0) {
65
- timeoutRef.current = setTimeout(function () {
66
- setCurrentIdRaw(null);
67
- }, timeoutMs);
68
- } else {
69
- setCurrentIdRaw(id);
70
- }
71
- }, [timeoutMs]);
72
- React.useEffect(function () {
73
- return function () {
74
- return clearTimeout(timeoutRef.current);
75
- };
76
- }, []);
77
- var value = React.useMemo(function () {
78
- return {
79
- currentId,
80
- setCurrentId,
81
- delay,
82
- timeoutMs,
83
- initialDelay: delay
84
- };
85
- }, [currentId, setCurrentId, delay, timeoutMs]);
86
- return React.createElement(DelayGroupContext.Provider, {
87
- value
88
- }, children);
48
+ var { children, delay, timeoutMs = 0 } = param;
49
+ var [currentId, setCurrentIdRaw] = React.useState(null);
50
+ var timeoutRef = React.useRef(void 0);
51
+ var setCurrentId = React.useCallback(function(id) {
52
+ clearTimeout(timeoutRef.current);
53
+ if (id == null && timeoutMs > 0) {
54
+ timeoutRef.current = setTimeout(function() {
55
+ setCurrentIdRaw(null);
56
+ }, timeoutMs);
57
+ } else {
58
+ setCurrentIdRaw(id);
59
+ }
60
+ }, [timeoutMs]);
61
+ React.useEffect(function() {
62
+ return function() {
63
+ return clearTimeout(timeoutRef.current);
64
+ };
65
+ }, []);
66
+ var value = React.useMemo(function() {
67
+ return {
68
+ currentId,
69
+ setCurrentId,
70
+ delay,
71
+ timeoutMs,
72
+ initialDelay: delay
73
+ };
74
+ }, [
75
+ currentId,
76
+ setCurrentId,
77
+ delay,
78
+ timeoutMs
79
+ ]);
80
+ return React.createElement(DelayGroupContext.Provider, { value }, children);
89
81
  }
90
82
  function useDelayGroup(context) {
91
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
92
- var {
93
- id
94
- } = options;
95
- var groupContext = React.useContext(DelayGroupContext);
96
- React.useEffect(function () {
97
- if (!context.open && groupContext.currentId === id) {
98
- groupContext.setCurrentId(null);
99
- }
100
- }, [context.open, id]);
101
- React.useEffect(function () {
102
- if (groupContext.currentId != null && groupContext.currentId !== id && context.open) {
103
- context.onOpenChange(false);
104
- }
105
- }, [groupContext.currentId, id, context.open]);
106
- if (groupContext.currentId != null) {
107
- return {
108
- delay: {
109
- open: 1,
110
- close: getClose(groupContext.initialDelay)
111
- },
112
- currentId: groupContext.currentId
113
- };
114
- }
115
- return {
116
- delay: groupContext.initialDelay,
117
- currentId: groupContext.currentId
118
- };
83
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
84
+ var { id } = options;
85
+ var groupContext = React.useContext(DelayGroupContext);
86
+ React.useEffect(function() {
87
+ if (!context.open && groupContext.currentId === id) {
88
+ groupContext.setCurrentId(null);
89
+ }
90
+ }, [context.open, id]);
91
+ React.useEffect(function() {
92
+ if (groupContext.currentId != null && groupContext.currentId !== id && context.open) {
93
+ context.onOpenChange(false);
94
+ }
95
+ }, [
96
+ groupContext.currentId,
97
+ id,
98
+ context.open
99
+ ]);
100
+ if (groupContext.currentId != null) {
101
+ return {
102
+ delay: {
103
+ open: 1,
104
+ close: getClose(groupContext.initialDelay)
105
+ },
106
+ currentId: groupContext.currentId
107
+ };
108
+ }
109
+ return {
110
+ delay: groupContext.initialDelay,
111
+ currentId: groupContext.currentId
112
+ };
119
113
  }
120
114
  function getClose(delay) {
121
- if (typeof delay === "number") return delay;
122
- var _delay_close;
123
- return (_delay_close = delay === null || delay === void 0 ? void 0 : delay.close) !== null && _delay_close !== void 0 ? _delay_close : 0;
115
+ if (typeof delay === "number") return delay;
116
+ var _delay_close;
117
+ return (_delay_close = delay === null || delay === void 0 ? void 0 : delay.close) !== null && _delay_close !== void 0 ? _delay_close : 0;
124
118
  }
119
+
125
120
  //# sourceMappingURL=useDelayGroup.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useDelayGroup_exports","__export","FloatingDelayGroup","useDelayGroup","useDelayGroupContext","module","exports","React","__toESM","require","DelayGroupContext","createContext","currentId","setCurrentId","delay","timeoutMs","initialDelay","useContext","param","children","setCurrentIdRaw","useState","timeoutRef","useRef","useCallback","id","clearTimeout","current","setTimeout","useEffect","useMemo","createElement","Provider","context","options","arguments","length","groupContext","open","onOpenChange"],"sources":["../../../src/interactions/useDelayGroup.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA,kBAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA,aAAA;EAAAC,oBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAuB,GAAAX,YAAA,CAAAK,qBAAA;AAWvB,IAAAO,KAAM,GAAAC,OAAA,CAAAC,OAAoB,QAAM;AAAsC,IACpEC,iBAAW,GAAAH,KAAA,CAAAI,aAAA;EACXC,SAAA,MAAc;EAAOC,YAAA,WAAAA,CAAA,GACrB;EACAC,KAAA;EACAC,SAAA;EACDC,YAAA;AAEM;AACL,SAAOZ,oBAAiBA,CAAA;EAC1B,OAAAG,KAAA,CAAAU,UAAA,CAAAP,iBAAA;AAKO;AAA4B,SACjCR,mBAAAgB,KAAA;EACA;IAAAC,QAAA;IAAAL,KAAA;IAAAC,SAAA;EAAA,IAAAG,KAAA;EACA,KAAAN,SAAY,EAAAQ,eAAA,IAAAb,KAAA,CAAAc,QAAA;EACd,IAIGC,UAAA,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A,CAAAK,IAAA;MAEAL,OAAO,CAAAM,YAAA;IACL;EAAoB,GACpB,CACFF,YAAA,CAAAzB,SAAA,EACFa,EAAA,EAEAQ,OAAS,CAAAK,IAAA,CACP;EACA,IAAAD,YAAc,CAAAzB,SAAS;IACzB","ignoreList":[]}
1
+ {"version":3,"file":"useDelayGroup.native.js","names":[],"sources":["cjs/interactions/useDelayGroup.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useDelayGroup_exports = {};\n__export(useDelayGroup_exports, {\n FloatingDelayGroup: () => FloatingDelayGroup,\n useDelayGroup: () => useDelayGroup,\n useDelayGroupContext: () => useDelayGroupContext\n});\nmodule.exports = __toCommonJS(useDelayGroup_exports);\nvar React = __toESM(require(\"react\"), 1);\nvar DelayGroupContext = React.createContext({\n currentId: null,\n setCurrentId: function() {\n },\n delay: 0,\n timeoutMs: 0,\n initialDelay: 0\n});\nfunction useDelayGroupContext() {\n return React.useContext(DelayGroupContext);\n}\nfunction FloatingDelayGroup(param) {\n var { children, delay, timeoutMs = 0 } = param;\n var [currentId, setCurrentIdRaw] = React.useState(null);\n var timeoutRef = React.useRef(void 0);\n var setCurrentId = React.useCallback(function(id) {\n clearTimeout(timeoutRef.current);\n if (id == null && timeoutMs > 0) {\n timeoutRef.current = setTimeout(function() {\n setCurrentIdRaw(null);\n }, timeoutMs);\n } else {\n setCurrentIdRaw(id);\n }\n }, [\n timeoutMs\n ]);\n React.useEffect(function() {\n return function() {\n return clearTimeout(timeoutRef.current);\n };\n }, []);\n var value = React.useMemo(function() {\n return {\n currentId,\n setCurrentId,\n delay,\n timeoutMs,\n initialDelay: delay\n };\n }, [\n currentId,\n setCurrentId,\n delay,\n timeoutMs\n ]);\n return React.createElement(DelayGroupContext.Provider, {\n value\n }, children);\n}\nfunction useDelayGroup(context) {\n var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var { id } = options;\n var groupContext = React.useContext(DelayGroupContext);\n React.useEffect(function() {\n if (!context.open && groupContext.currentId === id) {\n groupContext.setCurrentId(null);\n }\n }, [\n context.open,\n id\n ]);\n React.useEffect(function() {\n if (groupContext.currentId != null && groupContext.currentId !== id && context.open) {\n context.onOpenChange(false);\n }\n }, [\n groupContext.currentId,\n id,\n context.open\n ]);\n if (groupContext.currentId != null) {\n return {\n delay: {\n open: 1,\n close: getClose(groupContext.initialDelay)\n },\n currentId: groupContext.currentId\n };\n }\n return {\n delay: groupContext.initialDelay,\n currentId: groupContext.currentId\n };\n}\nfunction getClose(delay) {\n if (typeof delay === \"number\") return delay;\n var _delay_close;\n return (_delay_close = delay === null || delay === void 0 ? void 0 : delay.close) !== null && _delay_close !== void 0 ? _delay_close : 0;\n}\n//# sourceMappingURL=useDelayGroup.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAA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GACL,OAAO;IACL,MAAM;IACN,OAAO,SAAS,aAAa,YAAY;GAC3C;GACA,WAAW,aAAa;EAC1B;CACF;CACA,OAAO;EACL,OAAO,aAAa;EACpB,WAAW,aAAa;CAC1B;AACF;AACA,SAAS,SAAS,OAAO;CACvB,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI;CACJ,QAAQ,eAAe,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM,WAAW,QAAQ,iBAAiB,KAAK,IAAI,eAAe;AACzI"}
@@ -3,128 +3,120 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var useFocus_exports = {};
24
- __export(useFocus_exports, {
25
- useFocus: () => useFocus
26
- });
22
+ __export(useFocus_exports, { useFocus: () => useFocus });
27
23
  module.exports = __toCommonJS(useFocus_exports);
28
24
  var import_react = require("react");
29
25
  var import_utils = require("./utils.cjs");
30
26
  function isMacSafari() {
31
- return (0, import_utils.isMac)() && (0, import_utils.isSafari)();
27
+ return (0, import_utils.isMac)() && (0, import_utils.isSafari)();
32
28
  }
33
29
  function useFocus(context, props = {}) {
34
- const {
35
- open,
36
- onOpenChange,
37
- events,
38
- dataRef,
39
- elements
40
- } = context;
41
- const {
42
- enabled = true,
43
- visibleOnly = true
44
- } = props;
45
- const blockFocusRef = (0, import_react.useRef)(false);
46
- const timeoutRef = (0, import_react.useRef)(-1);
47
- const keyboardModalityRef = (0, import_react.useRef)(true);
48
- (0, import_react.useEffect)(() => {
49
- if (!enabled) return;
50
- const win = (0, import_utils.getDocument)(elements.domReference).defaultView || window;
51
- function onBlur() {
52
- if (!open && (0, import_utils.isHTMLElement)(elements.domReference) && elements.domReference === (0, import_utils.activeElement)((0, import_utils.getDocument)(elements.domReference))) {
53
- blockFocusRef.current = true;
54
- }
55
- }
56
- function onKeyDown() {
57
- keyboardModalityRef.current = true;
58
- }
59
- function onPointerDown() {
60
- keyboardModalityRef.current = false;
61
- }
62
- win.addEventListener("blur", onBlur);
63
- if (isMacSafari()) {
64
- win.addEventListener("keydown", onKeyDown, true);
65
- win.addEventListener("pointerdown", onPointerDown, true);
66
- }
67
- return () => {
68
- win.removeEventListener("blur", onBlur);
69
- if (isMacSafari()) {
70
- win.removeEventListener("keydown", onKeyDown, true);
71
- win.removeEventListener("pointerdown", onPointerDown, true);
72
- }
73
- };
74
- }, [elements.domReference, open, enabled]);
75
- (0, import_react.useEffect)(() => {
76
- if (!enabled) return;
77
- if (!events) return;
78
- function handleOpenChange({
79
- reason
80
- }) {
81
- if (reason === "reference-press" || reason === "escape-key") {
82
- blockFocusRef.current = true;
83
- }
84
- }
85
- events.on("openchange", handleOpenChange);
86
- return () => {
87
- events.off("openchange", handleOpenChange);
88
- };
89
- }, [events, enabled]);
90
- (0, import_react.useEffect)(() => {
91
- return () => {
92
- (0, import_utils.clearTimeoutIfSet)(timeoutRef);
93
- };
94
- }, []);
95
- const reference = (0, import_react.useMemo)(() => ({
96
- onMouseLeave() {
97
- blockFocusRef.current = false;
98
- },
99
- onFocus(event) {
100
- if (blockFocusRef.current) return;
101
- const target = (0, import_utils.getTarget)(event.nativeEvent);
102
- if (visibleOnly && (0, import_utils.isElement)(target)) {
103
- if (isMacSafari() && !event.relatedTarget) {
104
- if (!keyboardModalityRef.current && !(0, import_utils.isTypeableElement)(target)) {
105
- return;
106
- }
107
- } else if (!(0, import_utils.matchesFocusVisible)(target)) {
108
- return;
109
- }
110
- }
111
- onOpenChange(true, event.nativeEvent, "focus");
112
- },
113
- onBlur(event) {
114
- blockFocusRef.current = false;
115
- const relatedTarget = event.relatedTarget;
116
- const nativeEvent = event.nativeEvent;
117
- timeoutRef.current = window.setTimeout(() => {
118
- const activeEl = (0, import_utils.activeElement)(elements.domReference ? elements.domReference.ownerDocument : document);
119
- if (!relatedTarget && activeEl === elements.domReference) return;
120
- if ((0, import_utils.contains)(context.refs.floating.current, activeEl) || (0, import_utils.contains)(elements.domReference, activeEl)) {
121
- return;
122
- }
123
- onOpenChange(false, nativeEvent, "focus");
124
- });
125
- }
126
- }), [context.refs.floating, elements.domReference, onOpenChange, visibleOnly]);
127
- return (0, import_react.useMemo)(() => enabled ? {
128
- reference
129
- } : {}, [enabled, reference]);
130
- }
30
+ const { open, onOpenChange, events, dataRef, elements } = context;
31
+ const { enabled = true, visibleOnly = true } = props;
32
+ const blockFocusRef = (0, import_react.useRef)(false);
33
+ const timeoutRef = (0, import_react.useRef)(-1);
34
+ const keyboardModalityRef = (0, import_react.useRef)(true);
35
+ (0, import_react.useEffect)(() => {
36
+ if (!enabled) return;
37
+ const win = (0, import_utils.getDocument)(elements.domReference).defaultView || window;
38
+ function onBlur() {
39
+ if (!open && (0, import_utils.isHTMLElement)(elements.domReference) && elements.domReference === (0, import_utils.activeElement)((0, import_utils.getDocument)(elements.domReference))) {
40
+ blockFocusRef.current = true;
41
+ }
42
+ }
43
+ function onKeyDown() {
44
+ keyboardModalityRef.current = true;
45
+ }
46
+ function onPointerDown() {
47
+ keyboardModalityRef.current = false;
48
+ }
49
+ win.addEventListener("blur", onBlur);
50
+ if (isMacSafari()) {
51
+ win.addEventListener("keydown", onKeyDown, true);
52
+ win.addEventListener("pointerdown", onPointerDown, true);
53
+ }
54
+ return () => {
55
+ win.removeEventListener("blur", onBlur);
56
+ if (isMacSafari()) {
57
+ win.removeEventListener("keydown", onKeyDown, true);
58
+ win.removeEventListener("pointerdown", onPointerDown, true);
59
+ }
60
+ };
61
+ }, [
62
+ elements.domReference,
63
+ open,
64
+ enabled
65
+ ]);
66
+ (0, import_react.useEffect)(() => {
67
+ if (!enabled) return;
68
+ if (!events) return;
69
+ function handleOpenChange({ reason }) {
70
+ if (reason === "reference-press" || reason === "escape-key") {
71
+ blockFocusRef.current = true;
72
+ }
73
+ }
74
+ events.on("openchange", handleOpenChange);
75
+ return () => {
76
+ events.off("openchange", handleOpenChange);
77
+ };
78
+ }, [events, enabled]);
79
+ (0, import_react.useEffect)(() => {
80
+ return () => {
81
+ (0, import_utils.clearTimeoutIfSet)(timeoutRef);
82
+ };
83
+ }, []);
84
+ const reference = (0, import_react.useMemo)(() => ({
85
+ onMouseLeave() {
86
+ blockFocusRef.current = false;
87
+ },
88
+ onFocus(event) {
89
+ if (blockFocusRef.current) return;
90
+ const target = (0, import_utils.getTarget)(event.nativeEvent);
91
+ if (visibleOnly && (0, import_utils.isElement)(target)) {
92
+ if (isMacSafari() && !event.relatedTarget) {
93
+ if (!keyboardModalityRef.current && !(0, import_utils.isTypeableElement)(target)) {
94
+ return;
95
+ }
96
+ } else if (!(0, import_utils.matchesFocusVisible)(target)) {
97
+ return;
98
+ }
99
+ }
100
+ onOpenChange(true, event.nativeEvent, "focus");
101
+ },
102
+ onBlur(event) {
103
+ blockFocusRef.current = false;
104
+ const relatedTarget = event.relatedTarget;
105
+ const nativeEvent = event.nativeEvent;
106
+ timeoutRef.current = window.setTimeout(() => {
107
+ const activeEl = (0, import_utils.activeElement)(elements.domReference ? elements.domReference.ownerDocument : document);
108
+ if (!relatedTarget && activeEl === elements.domReference) return;
109
+ if ((0, import_utils.contains)(context.refs.floating.current, activeEl) || (0, import_utils.contains)(elements.domReference, activeEl)) {
110
+ return;
111
+ }
112
+ onOpenChange(false, nativeEvent, "focus");
113
+ });
114
+ }
115
+ }), [
116
+ context.refs.floating,
117
+ elements.domReference,
118
+ onOpenChange,
119
+ visibleOnly
120
+ ]);
121
+ return (0, import_react.useMemo)(() => enabled ? { reference } : {}, [enabled, reference]);
122
+ }
@@ -0,0 +1,130 @@
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 __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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var useFocus_exports = {};
24
+ __export(useFocus_exports, { useFocus: () => useFocus });
25
+ module.exports = __toCommonJS(useFocus_exports);
26
+ var import_react = require("react");
27
+ var import_utils = require("./utils.native.js");
28
+ function isMacSafari() {
29
+ return (0, import_utils.isMac)() && (0, import_utils.isSafari)();
30
+ }
31
+ function useFocus(context) {
32
+ var props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
33
+ var { open, onOpenChange, events, dataRef, elements } = context;
34
+ var { enabled = true, visibleOnly = true } = props;
35
+ var blockFocusRef = (0, import_react.useRef)(false);
36
+ var timeoutRef = (0, import_react.useRef)(-1);
37
+ var keyboardModalityRef = (0, import_react.useRef)(true);
38
+ (0, import_react.useEffect)(function() {
39
+ if (!enabled) return;
40
+ var win = (0, import_utils.getDocument)(elements.domReference).defaultView || window;
41
+ function onBlur() {
42
+ if (!open && (0, import_utils.isHTMLElement)(elements.domReference) && elements.domReference === (0, import_utils.activeElement)((0, import_utils.getDocument)(elements.domReference))) {
43
+ blockFocusRef.current = true;
44
+ }
45
+ }
46
+ function onKeyDown() {
47
+ keyboardModalityRef.current = true;
48
+ }
49
+ function onPointerDown() {
50
+ keyboardModalityRef.current = false;
51
+ }
52
+ win.addEventListener("blur", onBlur);
53
+ if (isMacSafari()) {
54
+ win.addEventListener("keydown", onKeyDown, true);
55
+ win.addEventListener("pointerdown", onPointerDown, true);
56
+ }
57
+ return function() {
58
+ win.removeEventListener("blur", onBlur);
59
+ if (isMacSafari()) {
60
+ win.removeEventListener("keydown", onKeyDown, true);
61
+ win.removeEventListener("pointerdown", onPointerDown, true);
62
+ }
63
+ };
64
+ }, [
65
+ elements.domReference,
66
+ open,
67
+ enabled
68
+ ]);
69
+ (0, import_react.useEffect)(function() {
70
+ if (!enabled) return;
71
+ if (!events) return;
72
+ function handleOpenChange(param) {
73
+ var { reason } = param;
74
+ if (reason === "reference-press" || reason === "escape-key") {
75
+ blockFocusRef.current = true;
76
+ }
77
+ }
78
+ events.on("openchange", handleOpenChange);
79
+ return function() {
80
+ events.off("openchange", handleOpenChange);
81
+ };
82
+ }, [events, enabled]);
83
+ (0, import_react.useEffect)(function() {
84
+ return function() {
85
+ (0, import_utils.clearTimeoutIfSet)(timeoutRef);
86
+ };
87
+ }, []);
88
+ var reference = (0, import_react.useMemo)(function() {
89
+ return {
90
+ onMouseLeave() {
91
+ blockFocusRef.current = false;
92
+ },
93
+ onFocus(event) {
94
+ if (blockFocusRef.current) return;
95
+ var target = (0, import_utils.getTarget)(event.nativeEvent);
96
+ if (visibleOnly && (0, import_utils.isElement)(target)) {
97
+ if (isMacSafari() && !event.relatedTarget) {
98
+ if (!keyboardModalityRef.current && !(0, import_utils.isTypeableElement)(target)) {
99
+ return;
100
+ }
101
+ } else if (!(0, import_utils.matchesFocusVisible)(target)) {
102
+ return;
103
+ }
104
+ }
105
+ onOpenChange(true, event.nativeEvent, "focus");
106
+ },
107
+ onBlur(event) {
108
+ blockFocusRef.current = false;
109
+ var relatedTarget = event.relatedTarget;
110
+ var nativeEvent = event.nativeEvent;
111
+ timeoutRef.current = window.setTimeout(function() {
112
+ var activeEl = (0, import_utils.activeElement)(elements.domReference ? elements.domReference.ownerDocument : document);
113
+ if (!relatedTarget && activeEl === elements.domReference) return;
114
+ if ((0, import_utils.contains)(context.refs.floating.current, activeEl) || (0, import_utils.contains)(elements.domReference, activeEl)) {
115
+ return;
116
+ }
117
+ onOpenChange(false, nativeEvent, "focus");
118
+ });
119
+ }
120
+ };
121
+ }, [
122
+ context.refs.floating,
123
+ elements.domReference,
124
+ onOpenChange,
125
+ visibleOnly
126
+ ]);
127
+ return (0, import_react.useMemo)(function() {
128
+ return enabled ? { reference } : {};
129
+ }, [enabled, reference]);
130
+ }