@tamagui/floating 3.0.7 → 3.0.9
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/Floating.native.cjs +2 -2
- package/dist/cjs/Floating.native.js +2 -2
- package/dist/cjs/Floating.native.js.map +1 -1
- package/dist/cjs/interactions/PopupTriggerMap.native.cjs +2 -6
- package/dist/cjs/interactions/PopupTriggerMap.native.js +2 -6
- package/dist/cjs/interactions/PopupTriggerMap.native.js.map +1 -1
- package/dist/cjs/interactions/safePolygon.native.cjs +2 -2
- package/dist/cjs/interactions/safePolygon.native.js +2 -2
- package/dist/cjs/interactions/safePolygon.native.js.map +1 -1
- package/dist/cjs/interactions/useDelayGroup.native.cjs +6 -6
- package/dist/cjs/interactions/useDelayGroup.native.js +6 -6
- package/dist/cjs/interactions/useDelayGroup.native.js.map +1 -1
- package/dist/cjs/interactions/useListNavigation.native.cjs +2 -2
- package/dist/cjs/interactions/useListNavigation.native.js +2 -2
- package/dist/cjs/interactions/useListNavigation.native.js.map +1 -1
- package/dist/cjs/interactions/useRole.native.cjs +1 -1
- package/dist/cjs/interactions/useRole.native.js +1 -1
- package/dist/cjs/interactions/useRole.native.js.map +1 -1
- package/dist/cjs/interactions/useTypeahead.native.cjs +3 -3
- package/dist/cjs/interactions/useTypeahead.native.js +3 -3
- package/dist/cjs/interactions/useTypeahead.native.js.map +1 -1
- package/dist/cjs/interactions/utils.native.cjs +2 -2
- package/dist/cjs/interactions/utils.native.js +2 -2
- package/dist/cjs/interactions/utils.native.js.map +1 -1
- package/dist/cjs/middleware/inner.native.cjs +5 -5
- package/dist/cjs/middleware/inner.native.js +5 -5
- package/dist/cjs/middleware/inner.native.js.map +1 -1
- package/dist/cjs/useFloating.native.cjs +1 -1
- package/dist/cjs/useFloating.native.js +1 -1
- package/dist/cjs/useFloating.native.js.map +1 -1
- package/dist/esm/Floating.native.js +2 -2
- package/dist/esm/Floating.native.js.map +1 -1
- package/dist/esm/interactions/PopupTriggerMap.native.js +2 -6
- package/dist/esm/interactions/PopupTriggerMap.native.js.map +1 -1
- package/dist/esm/interactions/safePolygon.native.js +2 -2
- package/dist/esm/interactions/safePolygon.native.js.map +1 -1
- package/dist/esm/interactions/useDelayGroup.native.js +6 -6
- package/dist/esm/interactions/useDelayGroup.native.js.map +1 -1
- package/dist/esm/interactions/useListNavigation.native.js +2 -2
- package/dist/esm/interactions/useListNavigation.native.js.map +1 -1
- package/dist/esm/interactions/useRole.native.js +1 -1
- package/dist/esm/interactions/useRole.native.js.map +1 -1
- package/dist/esm/interactions/useTypeahead.native.js +3 -3
- package/dist/esm/interactions/useTypeahead.native.js.map +1 -1
- package/dist/esm/interactions/utils.native.js +2 -2
- package/dist/esm/interactions/utils.native.js.map +1 -1
- package/dist/esm/middleware/inner.native.js +5 -5
- package/dist/esm/middleware/inner.native.js.map +1 -1
- package/dist/esm/useFloating.native.js +1 -1
- package/dist/esm/useFloating.native.js.map +1 -1
- package/package.json +4 -4
|
@@ -29,8 +29,8 @@ __export(Floating_native_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(Floating_native_exports);
|
|
31
31
|
__reExport(Floating_native_exports, require("@floating-ui/react-native"), module.exports);
|
|
32
|
-
var autoUpdate = function() {};
|
|
33
|
-
var getOverflowAncestors = function() {
|
|
32
|
+
var autoUpdate = function autoUpdate2() {};
|
|
33
|
+
var getOverflowAncestors = function getOverflowAncestors2() {
|
|
34
34
|
return [];
|
|
35
35
|
};
|
|
36
36
|
var platform = null;
|
|
@@ -29,8 +29,8 @@ __export(Floating_native_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(Floating_native_exports);
|
|
31
31
|
__reExport(Floating_native_exports, require("@floating-ui/react-native"), module.exports);
|
|
32
|
-
var autoUpdate = function() {};
|
|
33
|
-
var getOverflowAncestors = function() {
|
|
32
|
+
var autoUpdate = function autoUpdate2() {};
|
|
33
|
+
var getOverflowAncestors = function getOverflowAncestors2() {
|
|
34
34
|
return [];
|
|
35
35
|
};
|
|
36
36
|
var platform = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Floating.native.js","names":[],"sources":["cjs/Floating.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Floating_native_exports = {};\n__export(Floating_native_exports, {\n autoUpdate: () => autoUpdate,\n getOverflowAncestors: () => getOverflowAncestors,\n platform: () => platform\n});\nmodule.exports = __toCommonJS(Floating_native_exports);\n__reExport(Floating_native_exports, require(\"@floating-ui/react-native\"), module.exports);\nvar autoUpdate = function() {\n};\nvar getOverflowAncestors = function() {\n return [];\n};\nvar platform = null;\n//# sourceMappingURL=Floating.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,0BAA0B,CAAC;AAC/B,SAAS,yBAAyB;CAChC,kBAAkB;CAClB,4BAA4B;CAC5B,gBAAgB;AAClB,CAAC;AACD,OAAO,UAAU,aAAa,uBAAuB;AACrD,WAAW,yBAAyB,QAAQ,2BAA2B,GAAG,OAAO,OAAO;AACxF,IAAI,aAAa,
|
|
1
|
+
{"version":3,"file":"Floating.native.js","names":[],"sources":["cjs/Floating.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Floating_native_exports = {};\n__export(Floating_native_exports, {\n autoUpdate: () => autoUpdate,\n getOverflowAncestors: () => getOverflowAncestors,\n platform: () => platform\n});\nmodule.exports = __toCommonJS(Floating_native_exports);\n__reExport(Floating_native_exports, require(\"@floating-ui/react-native\"), module.exports);\nvar autoUpdate = function autoUpdate2() {\n};\nvar getOverflowAncestors = function getOverflowAncestors2() {\n return [];\n};\nvar platform = null;\n//# sourceMappingURL=Floating.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,0BAA0B,CAAC;AAC/B,SAAS,yBAAyB;CAChC,kBAAkB;CAClB,4BAA4B;CAC5B,gBAAgB;AAClB,CAAC;AACD,OAAO,UAAU,aAAa,uBAAuB;AACrD,WAAW,yBAAyB,QAAQ,2BAA2B,GAAG,OAAO,OAAO;AACxF,IAAI,aAAa,SAAS,cAAc,CACxC;AACA,IAAI,uBAAuB,SAAS,wBAAwB;CAC1D,OAAO,CAAC;AACV;AACA,IAAI,WAAW"}
|
|
@@ -24,9 +24,7 @@ var PopupTriggerMap_exports = {};
|
|
|
24
24
|
__export(PopupTriggerMap_exports, { PopupTriggerMap: () => PopupTriggerMap });
|
|
25
25
|
module.exports = __toCommonJS(PopupTriggerMap_exports);
|
|
26
26
|
function _class_call_check(instance, Constructor) {
|
|
27
|
-
if (!(instance instanceof Constructor))
|
|
28
|
-
throw new TypeError("Cannot call a class as a function");
|
|
29
|
-
}
|
|
27
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
30
28
|
}
|
|
31
29
|
function _defineProperties(target, props) {
|
|
32
30
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -50,9 +48,7 @@ function _define_property(obj, key, value) {
|
|
|
50
48
|
configurable: true,
|
|
51
49
|
writable: true
|
|
52
50
|
});
|
|
53
|
-
} else
|
|
54
|
-
obj[key] = value;
|
|
55
|
-
}
|
|
51
|
+
} else obj[key] = value;
|
|
56
52
|
return obj;
|
|
57
53
|
}
|
|
58
54
|
var PopupTriggerMap = /* @__PURE__ */ (function() {
|
|
@@ -24,9 +24,7 @@ var PopupTriggerMap_exports = {};
|
|
|
24
24
|
__export(PopupTriggerMap_exports, { PopupTriggerMap: () => PopupTriggerMap });
|
|
25
25
|
module.exports = __toCommonJS(PopupTriggerMap_exports);
|
|
26
26
|
function _class_call_check(instance, Constructor) {
|
|
27
|
-
if (!(instance instanceof Constructor))
|
|
28
|
-
throw new TypeError("Cannot call a class as a function");
|
|
29
|
-
}
|
|
27
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
30
28
|
}
|
|
31
29
|
function _defineProperties(target, props) {
|
|
32
30
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -50,9 +48,7 @@ function _define_property(obj, key, value) {
|
|
|
50
48
|
configurable: true,
|
|
51
49
|
writable: true
|
|
52
50
|
});
|
|
53
|
-
} else
|
|
54
|
-
obj[key] = value;
|
|
55
|
-
}
|
|
51
|
+
} else obj[key] = value;
|
|
56
52
|
return obj;
|
|
57
53
|
}
|
|
58
54
|
var PopupTriggerMap = /* @__PURE__ */ (function() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupTriggerMap.native.js","names":[],"sources":["cjs/interactions/PopupTriggerMap.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar PopupTriggerMap_exports = {};\n__export(PopupTriggerMap_exports, {\n PopupTriggerMap: () => PopupTriggerMap\n});\nmodule.exports = __toCommonJS(PopupTriggerMap_exports);\nfunction _class_call_check(instance, Constructor) {\n if (!(instance instanceof Constructor))
|
|
1
|
+
{"version":3,"file":"PopupTriggerMap.native.js","names":[],"sources":["cjs/interactions/PopupTriggerMap.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar PopupTriggerMap_exports = {};\n__export(PopupTriggerMap_exports, {\n PopupTriggerMap: () => PopupTriggerMap\n});\nmodule.exports = __toCommonJS(PopupTriggerMap_exports);\nfunction _class_call_check(instance, Constructor) {\n if (!(instance instanceof Constructor)) throw new TypeError(\"Cannot call a class as a function\");\n}\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\nfunction _create_class(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\nfunction _define_property(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else obj[key] = value;\n return obj;\n}\nvar PopupTriggerMap = /* @__PURE__ */ (function() {\n \"use strict\";\n function PopupTriggerMap2() {\n _class_call_check(this, PopupTriggerMap2);\n _define_property(this, \"map\", /* @__PURE__ */ new Map());\n _define_property(this, \"elements\", /* @__PURE__ */ new Set());\n }\n _create_class(PopupTriggerMap2, [\n {\n key: \"add\",\n value: function add(id, element) {\n var prev = this.map.get(id);\n if (prev) {\n this.elements.delete(prev);\n }\n this.map.set(id, element);\n this.elements.add(element);\n }\n },\n {\n key: \"delete\",\n value: function _delete(id) {\n var el = this.map.get(id);\n if (el) {\n this.elements.delete(el);\n this.map.delete(id);\n }\n }\n },\n {\n key: \"hasElement\",\n value: function hasElement(element) {\n return this.elements.has(element);\n }\n }\n ]);\n return PopupTriggerMap2;\n})();\n//# sourceMappingURL=PopupTriggerMap.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,0BAA0B,CAAC;AAC/B,SAAS,yBAAyB,EAChC,uBAAuB,gBACzB,CAAC;AACD,OAAO,UAAU,aAAa,uBAAuB;AACrD,SAAS,kBAAkB,UAAU,aAAa;CAChD,IAAI,EAAE,oBAAoB,cAAc,MAAM,IAAI,UAAU,mCAAmC;AACjG;AACA,SAAS,kBAAkB,QAAQ,OAAO;CACxC,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,IAAI,aAAa,MAAM;EACvB,WAAW,aAAa,WAAW,cAAc;EACjD,WAAW,eAAe;EAC1B,IAAI,WAAW,YAAY,WAA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
|
|
129
|
-
var fn = function(param) {
|
|
129
|
+
var fn = function fn2(param) {
|
|
130
130
|
var { x, y, placement, elements, onClose } = param;
|
|
131
131
|
hasLanded = false;
|
|
132
132
|
lastX = null;
|
|
133
133
|
lastY = null;
|
|
134
134
|
return function onMouseMove(event) {
|
|
135
|
+
var _elements_domReference;
|
|
135
136
|
function close() {
|
|
136
137
|
(0, import_utils.clearTimeoutIfSet)(timeoutRef);
|
|
137
138
|
onClose();
|
|
138
139
|
}
|
|
139
140
|
(0, import_utils.clearTimeoutIfSet)(timeoutRef);
|
|
140
|
-
var _elements_domReference;
|
|
141
141
|
var domReference = (_elements_domReference = elements.domReference) !== null && _elements_domReference !== void 0 ? _elements_domReference : elements.reference;
|
|
142
142
|
if (!domReference || !elements.floating || placement == null || x == null || y == null) {
|
|
143
143
|
return;
|
|
@@ -126,18 +126,18 @@ function safePolygon() {
|
|
|
126
126
|
lastCursorTime = currentTime;
|
|
127
127
|
return speed;
|
|
128
128
|
}
|
|
129
|
-
var fn = function(param) {
|
|
129
|
+
var fn = function fn2(param) {
|
|
130
130
|
var { x, y, placement, elements, onClose } = param;
|
|
131
131
|
hasLanded = false;
|
|
132
132
|
lastX = null;
|
|
133
133
|
lastY = null;
|
|
134
134
|
return function onMouseMove(event) {
|
|
135
|
+
var _elements_domReference;
|
|
135
136
|
function close() {
|
|
136
137
|
(0, import_utils.clearTimeoutIfSet)(timeoutRef);
|
|
137
138
|
onClose();
|
|
138
139
|
}
|
|
139
140
|
(0, import_utils.clearTimeoutIfSet)(timeoutRef);
|
|
140
|
-
var _elements_domReference;
|
|
141
141
|
var domReference = (_elements_domReference = elements.domReference) !== null && _elements_domReference !== void 0 ? _elements_domReference : elements.reference;
|
|
142
142
|
if (!domReference || !elements.floating || placement == null || x == null || y == null) {
|
|
143
143
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safePolygon.native.js","names":[],"sources":["cjs/interactions/safePolygon.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar safePolygon_exports = {};\n__export(safePolygon_exports, {\n safePolygon: () => safePolygon\n});\nmodule.exports = __toCommonJS(safePolygon_exports);\nvar import_utils = require(\"./utils\");\nfunction isPointInPolygon(point, polygon) {\n var [x, y] = point;\n var isInside2 = false;\n var length = polygon.length;\n for (var i = 0, j = length - 1; i < length; j = i++) {\n var [xi, yi] = polygon[i] || [\n 0,\n 0\n ];\n var [xj, yj] = polygon[j] || [\n 0,\n 0\n ];\n var intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi;\n if (intersect) {\n isInside2 = !isInside2;\n }\n }\n return isInside2;\n}\nfunction isInside(point, rect) {\n return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height;\n}\nvar debugSvg = null;\nfunction debugDrawPolygon(polygon, trough, cursor, anchor) {\n if (!debugSvg) {\n debugSvg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n debugSvg.id = \"__safe-polygon-debug\";\n Object.assign(debugSvg.style, {\n position: \"fixed\",\n inset: \"0\",\n width: \"100vw\",\n height: \"100vh\",\n pointerEvents: \"none\",\n zIndex: \"999999\"\n });\n document.body.appendChild(debugSvg);\n }\n debugSvg.innerHTML = \"\";\n if (trough.length) {\n var troughEl = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polygon\");\n troughEl.setAttribute(\"points\", trough.map(function(p) {\n return p.join(\",\");\n }).join(\" \"));\n troughEl.setAttribute(\"fill\", \"rgba(0,100,255,0.15)\");\n troughEl.setAttribute(\"stroke\", \"rgba(0,100,255,0.6)\");\n troughEl.setAttribute(\"stroke-width\", \"1\");\n debugSvg.appendChild(troughEl);\n }\n if (polygon.length) {\n var polyEl = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polygon\");\n polyEl.setAttribute(\"points\", polygon.map(function(p) {\n return p.join(\",\");\n }).join(\" \"));\n polyEl.setAttribute(\"fill\", \"rgba(255,50,50,0.2)\");\n polyEl.setAttribute(\"stroke\", \"rgba(255,50,50,0.8)\");\n polyEl.setAttribute(\"stroke-width\", \"1.5\");\n debugSvg.appendChild(polyEl);\n }\n var anchorCircle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"circle\");\n anchorCircle.setAttribute(\"cx\", String(anchor[0]));\n anchorCircle.setAttribute(\"cy\", String(anchor[1]));\n anchorCircle.setAttribute(\"r\", \"5\");\n anchorCircle.setAttribute(\"fill\", \"lime\");\n anchorCircle.setAttribute(\"stroke\", \"darkgreen\");\n anchorCircle.setAttribute(\"stroke-width\", \"1.5\");\n debugSvg.appendChild(anchorCircle);\n var cursorCircle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"circle\");\n cursorCircle.setAttribute(\"cx\", String(cursor[0]));\n cursorCircle.setAttribute(\"cy\", String(cursor[1]));\n cursorCircle.setAttribute(\"r\", \"4\");\n cursorCircle.setAttribute(\"fill\", \"yellow\");\n cursorCircle.setAttribute(\"stroke\", \"orange\");\n cursorCircle.setAttribute(\"stroke-width\", \"1.5\");\n debugSvg.appendChild(cursorCircle);\n}\nfunction debugClear() {\n if (debugSvg) {\n debugSvg.remove();\n debugSvg = null;\n }\n}\nfunction safePolygon() {\n var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n var { buffer = 0.5, blockPointerEvents = false, requireIntent = true, __debug = false } = options;\n var timeoutRef = {\n current: -1\n };\n var hasLanded = false;\n var lastX = null;\n var lastY = null;\n var lastCursorTime = typeof performance !== \"undefined\" ? performance.now() : 0;\n function getCursorSpeed(x, y) {\n var currentTime = performance.now();\n var elapsedTime = currentTime - lastCursorTime;\n if (lastX === null || lastY === null || elapsedTime === 0) {\n lastX = x;\n lastY = y;\n lastCursorTime = currentTime;\n return null;\n }\n var deltaX = x - lastX;\n var deltaY = y - lastY;\n var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n var speed = distance / elapsedTime;\n lastX = x;\n lastY = y;\n lastCursorTime = currentTime;\n return speed;\n }\n var fn = function(param) {\n var { x, y, placement, elements, onClose } = param;\n hasLanded = false;\n lastX = null;\n lastY = null;\n return function onMouseMove(event) {\n function close() {\n (0, import_utils.clearTimeoutIfSet)(timeoutRef);\n onClose();\n }\n (0, import_utils.clearTimeoutIfSet)(timeoutRef);\n var _elements_domReference;\n var domReference = (_elements_domReference = elements.domReference) !== null && _elements_domReference !== void 0 ? _elements_domReference : elements.reference;\n if (!domReference || !elements.floating || placement == null || x == null || y == null) {\n return;\n }\n var { clientX, clientY } = event;\n var clientPoint = [\n clientX,\n clientY\n ];\n var target = (0, import_utils.getTarget)(event);\n var isLeave = event.type === \"mouseleave\";\n var isOverFloatingEl = (0, import_utils.contains)(elements.floating, target);\n var isOverReferenceEl = (0, import_utils.contains)(domReference, target);\n var refRect = domReference.getBoundingClientRect();\n var rect = elements.floating.getBoundingClientRect();\n var side = placement.split(\"-\")[0];\n var cursorLeaveFromRight = x > rect.right - rect.width / 2;\n var cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;\n var isOverReferenceRect = isInside(clientPoint, refRect);\n var isFloatingWider = rect.width > refRect.width;\n var isFloatingTaller = rect.height > refRect.height;\n var left = (isFloatingWider ? refRect : rect).left;\n var right = (isFloatingWider ? refRect : rect).right;\n var top = (isFloatingTaller ? refRect : rect).top;\n var bottom = (isFloatingTaller ? refRect : rect).bottom;\n if (isOverFloatingEl) {\n hasLanded = true;\n if (!isLeave) {\n return;\n }\n }\n if (isOverReferenceEl) {\n hasLanded = false;\n }\n if (isOverReferenceEl && !isLeave) {\n hasLanded = true;\n return;\n }\n if (!isOverReferenceEl && isOverReferenceRect && !isLeave) {\n return;\n }\n if (isLeave && event.relatedTarget && (0, import_utils.contains)(elements.floating, event.relatedTarget)) {\n return;\n }\n if (side === \"top\" && y >= refRect.bottom - 1 || side === \"bottom\" && y <= refRect.top + 1 || side === \"left\" && x >= refRect.right - 1 || side === \"right\" && x <= refRect.left + 1) {\n return close();\n }\n var rectPoly = [];\n switch (side) {\n case \"top\":\n rectPoly = [\n [\n left,\n refRect.top + 1\n ],\n [\n left,\n rect.bottom - 1\n ],\n [\n right,\n rect.bottom - 1\n ],\n [\n right,\n refRect.top + 1\n ]\n ];\n break;\n case \"bottom\":\n rectPoly = [\n [\n left,\n rect.top + 1\n ],\n [\n left,\n refRect.bottom - 1\n ],\n [\n right,\n refRect.bottom - 1\n ],\n [\n right,\n rect.top + 1\n ]\n ];\n break;\n case \"left\":\n rectPoly = [\n [\n rect.right - 1,\n bottom\n ],\n [\n rect.right - 1,\n top\n ],\n [\n refRect.left + 1,\n top\n ],\n [\n refRect.left + 1,\n bottom\n ]\n ];\n break;\n case \"right\":\n rectPoly = [\n [\n refRect.right - 1,\n bottom\n ],\n [\n refRect.right - 1,\n top\n ],\n [\n rect.left + 1,\n top\n ],\n [\n rect.left + 1,\n bottom\n ]\n ];\n break;\n }\n function getPolygon(param2) {\n var [x2, y2] = param2;\n switch (side) {\n case \"top\": {\n var cursorPointOne = [\n isFloatingWider ? x2 + buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4,\n y2 + buffer + 1\n ];\n var cursorPointTwo = [\n isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4,\n y2 + buffer + 1\n ];\n var commonPoints = [\n [\n rect.left,\n cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top\n ],\n [\n rect.right,\n cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer\n ]\n ];\n return [\n cursorPointOne,\n cursorPointTwo,\n ...commonPoints\n ];\n }\n case \"bottom\": {\n var cursorPointOne1 = [\n isFloatingWider ? x2 + buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4,\n y2 - buffer\n ];\n var cursorPointTwo1 = [\n isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4,\n y2 - buffer\n ];\n var commonPoints1 = [\n [\n rect.left,\n cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom\n ],\n [\n rect.right,\n cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer\n ]\n ];\n return [\n cursorPointOne1,\n cursorPointTwo1,\n ...commonPoints1\n ];\n }\n case \"left\": {\n var cursorPointOne2 = [\n x2 + buffer + 1,\n isFloatingTaller ? y2 + buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4\n ];\n var cursorPointTwo2 = [\n x2 + buffer + 1,\n isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4\n ];\n var commonPoints2 = [\n [\n cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left,\n rect.top\n ],\n [\n cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer,\n rect.bottom\n ]\n ];\n return [\n ...commonPoints2,\n cursorPointOne2,\n cursorPointTwo2\n ];\n }\n case \"right\": {\n var cursorPointOne3 = [\n x2 - buffer,\n isFloatingTaller ? y2 + buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4\n ];\n var cursorPointTwo3 = [\n x2 - buffer,\n isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4\n ];\n var commonPoints3 = [\n [\n cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right,\n rect.top\n ],\n [\n cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer,\n rect.bottom\n ]\n ];\n return [\n cursorPointOne3,\n cursorPointTwo3,\n ...commonPoints3\n ];\n }\n }\n }\n var poly = getPolygon([\n x,\n y\n ]);\n if (__debug) {\n debugDrawPolygon(poly, rectPoly, clientPoint, [\n x,\n y\n ]);\n }\n if (isPointInPolygon([\n clientX,\n clientY\n ], rectPoly)) {\n return;\n }\n if (hasLanded && !isOverReferenceRect) {\n if (__debug) debugClear();\n return close();\n }\n if (isPointInPolygon([\n clientX,\n clientY\n ], poly)) {\n return;\n }\n if (!isLeave && requireIntent) {\n var cursorSpeed = getCursorSpeed(clientX, clientY);\n var cursorSpeedThreshold = 0.1;\n if (cursorSpeed !== null && cursorSpeed < cursorSpeedThreshold) {\n if (__debug) debugClear();\n return close();\n }\n }\n if (__debug) debugClear();\n close();\n };\n };\n fn.__options = {\n blockPointerEvents\n };\n return fn;\n}\n//# sourceMappingURL=safePolygon.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAA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BAAwB,KAAK,SAAS,IAAI,KAAK,SAAS,CAC/F;MACA,IAAI,kBAAkB,CACpB,KAAK,QACL,mBAAmB,KAAK,SAAS,IAAI,wBAAwB,KAAK,SAAS,IAAI,KAAK,SAAS,CAC/F;MACA,IAAI,gBAAgB,CAClB,CACE,wBAAwB,KAAK,OAAO,SAAS,mBAAmB,KAAK,OAAO,SAAS,KAAK,OAC1F,KAAK,GACP,GACA,CACE,wBAAwB,mBAAmB,KAAK,OAAO,SAAS,KAAK,QAAQ,KAAK,OAAO,QACzF,KAAK,MACP,CACF;MACA,OAAO;OACL;OACA;OACA,GAAG;MACL;KACF;IACF;GACF;GACA,IAAI,OAAO,WAAW,CACpB,GACA,CACF,CAAC;GACD,IAAI,SAAS;IACX,iBAAiB,MAAM,UAAU,aAAa,CAC5C,GACA,CACF,CAAC;GACH;GACA,IAAI,iBAAiB,CACnB,SACA,OACF,GAAG,QAAQ,GAAG;IACZ;GACF;GACA,IAAI,aAAa,CAAC,qBAAqB;IACrC,IAAI,SAAS,WAAW;IACxB,OAAO,MAAM;GACf;GACA,IAAI,iBAAiB,CACnB,SACA,OACF,GAAG,IAAI,GAAG;IACR;GACF;GACA,IAAI,CAAC,WAAW,eAAe;IAC7B,IAAI,cAAc,eAAe,SAAS,OAAO;IACjD,IAAI,uBAAuB;IAC3B,IAAI,gBAAgB,QAAQ,cAAc,sBAAsB;KAC9D,IAAI,SAAS,WAAW;KACxB,OAAO,MAAM;IACf;GACF;GACA,IAAI,SAAS,WAAW;GACxB,MAAM;EACR;CACF;CACA,GAAG,YAAY,EACb,mBACF;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"safePolygon.native.js","names":[],"sources":["cjs/interactions/safePolygon.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar safePolygon_exports = {};\n__export(safePolygon_exports, {\n safePolygon: () => safePolygon\n});\nmodule.exports = __toCommonJS(safePolygon_exports);\nvar import_utils = require(\"./utils\");\nfunction isPointInPolygon(point, polygon) {\n var [x, y] = point;\n var isInside2 = false;\n var length = polygon.length;\n for (var i = 0, j = length - 1; i < length; j = i++) {\n var [xi, yi] = polygon[i] || [\n 0,\n 0\n ];\n var [xj, yj] = polygon[j] || [\n 0,\n 0\n ];\n var intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi;\n if (intersect) {\n isInside2 = !isInside2;\n }\n }\n return isInside2;\n}\nfunction isInside(point, rect) {\n return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height;\n}\nvar debugSvg = null;\nfunction debugDrawPolygon(polygon, trough, cursor, anchor) {\n if (!debugSvg) {\n debugSvg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n debugSvg.id = \"__safe-polygon-debug\";\n Object.assign(debugSvg.style, {\n position: \"fixed\",\n inset: \"0\",\n width: \"100vw\",\n height: \"100vh\",\n pointerEvents: \"none\",\n zIndex: \"999999\"\n });\n document.body.appendChild(debugSvg);\n }\n debugSvg.innerHTML = \"\";\n if (trough.length) {\n var troughEl = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polygon\");\n troughEl.setAttribute(\"points\", trough.map(function(p) {\n return p.join(\",\");\n }).join(\" \"));\n troughEl.setAttribute(\"fill\", \"rgba(0,100,255,0.15)\");\n troughEl.setAttribute(\"stroke\", \"rgba(0,100,255,0.6)\");\n troughEl.setAttribute(\"stroke-width\", \"1\");\n debugSvg.appendChild(troughEl);\n }\n if (polygon.length) {\n var polyEl = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polygon\");\n polyEl.setAttribute(\"points\", polygon.map(function(p) {\n return p.join(\",\");\n }).join(\" \"));\n polyEl.setAttribute(\"fill\", \"rgba(255,50,50,0.2)\");\n polyEl.setAttribute(\"stroke\", \"rgba(255,50,50,0.8)\");\n polyEl.setAttribute(\"stroke-width\", \"1.5\");\n debugSvg.appendChild(polyEl);\n }\n var anchorCircle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"circle\");\n anchorCircle.setAttribute(\"cx\", String(anchor[0]));\n anchorCircle.setAttribute(\"cy\", String(anchor[1]));\n anchorCircle.setAttribute(\"r\", \"5\");\n anchorCircle.setAttribute(\"fill\", \"lime\");\n anchorCircle.setAttribute(\"stroke\", \"darkgreen\");\n anchorCircle.setAttribute(\"stroke-width\", \"1.5\");\n debugSvg.appendChild(anchorCircle);\n var cursorCircle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"circle\");\n cursorCircle.setAttribute(\"cx\", String(cursor[0]));\n cursorCircle.setAttribute(\"cy\", String(cursor[1]));\n cursorCircle.setAttribute(\"r\", \"4\");\n cursorCircle.setAttribute(\"fill\", \"yellow\");\n cursorCircle.setAttribute(\"stroke\", \"orange\");\n cursorCircle.setAttribute(\"stroke-width\", \"1.5\");\n debugSvg.appendChild(cursorCircle);\n}\nfunction debugClear() {\n if (debugSvg) {\n debugSvg.remove();\n debugSvg = null;\n }\n}\nfunction safePolygon() {\n var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n var { buffer = 0.5, blockPointerEvents = false, requireIntent = true, __debug = false } = options;\n var timeoutRef = {\n current: -1\n };\n var hasLanded = false;\n var lastX = null;\n var lastY = null;\n var lastCursorTime = typeof performance !== \"undefined\" ? performance.now() : 0;\n function getCursorSpeed(x, y) {\n var currentTime = performance.now();\n var elapsedTime = currentTime - lastCursorTime;\n if (lastX === null || lastY === null || elapsedTime === 0) {\n lastX = x;\n lastY = y;\n lastCursorTime = currentTime;\n return null;\n }\n var deltaX = x - lastX;\n var deltaY = y - lastY;\n var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n var speed = distance / elapsedTime;\n lastX = x;\n lastY = y;\n lastCursorTime = currentTime;\n return speed;\n }\n var fn = function fn2(param) {\n var { x, y, placement, elements, onClose } = param;\n hasLanded = false;\n lastX = null;\n lastY = null;\n return function onMouseMove(event) {\n var _elements_domReference;\n function close() {\n (0, import_utils.clearTimeoutIfSet)(timeoutRef);\n onClose();\n }\n (0, import_utils.clearTimeoutIfSet)(timeoutRef);\n var domReference = (_elements_domReference = elements.domReference) !== null && _elements_domReference !== void 0 ? _elements_domReference : elements.reference;\n if (!domReference || !elements.floating || placement == null || x == null || y == null) {\n return;\n }\n var { clientX, clientY } = event;\n var clientPoint = [\n clientX,\n clientY\n ];\n var target = (0, import_utils.getTarget)(event);\n var isLeave = event.type === \"mouseleave\";\n var isOverFloatingEl = (0, import_utils.contains)(elements.floating, target);\n var isOverReferenceEl = (0, import_utils.contains)(domReference, target);\n var refRect = domReference.getBoundingClientRect();\n var rect = elements.floating.getBoundingClientRect();\n var side = placement.split(\"-\")[0];\n var cursorLeaveFromRight = x > rect.right - rect.width / 2;\n var cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;\n var isOverReferenceRect = isInside(clientPoint, refRect);\n var isFloatingWider = rect.width > refRect.width;\n var isFloatingTaller = rect.height > refRect.height;\n var left = (isFloatingWider ? refRect : rect).left;\n var right = (isFloatingWider ? refRect : rect).right;\n var top = (isFloatingTaller ? refRect : rect).top;\n var bottom = (isFloatingTaller ? refRect : rect).bottom;\n if (isOverFloatingEl) {\n hasLanded = true;\n if (!isLeave) {\n return;\n }\n }\n if (isOverReferenceEl) {\n hasLanded = false;\n }\n if (isOverReferenceEl && !isLeave) {\n hasLanded = true;\n return;\n }\n if (!isOverReferenceEl && isOverReferenceRect && !isLeave) {\n return;\n }\n if (isLeave && event.relatedTarget && (0, import_utils.contains)(elements.floating, event.relatedTarget)) {\n return;\n }\n if (side === \"top\" && y >= refRect.bottom - 1 || side === \"bottom\" && y <= refRect.top + 1 || side === \"left\" && x >= refRect.right - 1 || side === \"right\" && x <= refRect.left + 1) {\n return close();\n }\n var rectPoly = [];\n switch (side) {\n case \"top\":\n rectPoly = [\n [\n left,\n refRect.top + 1\n ],\n [\n left,\n rect.bottom - 1\n ],\n [\n right,\n rect.bottom - 1\n ],\n [\n right,\n refRect.top + 1\n ]\n ];\n break;\n case \"bottom\":\n rectPoly = [\n [\n left,\n rect.top + 1\n ],\n [\n left,\n refRect.bottom - 1\n ],\n [\n right,\n refRect.bottom - 1\n ],\n [\n right,\n rect.top + 1\n ]\n ];\n break;\n case \"left\":\n rectPoly = [\n [\n rect.right - 1,\n bottom\n ],\n [\n rect.right - 1,\n top\n ],\n [\n refRect.left + 1,\n top\n ],\n [\n refRect.left + 1,\n bottom\n ]\n ];\n break;\n case \"right\":\n rectPoly = [\n [\n refRect.right - 1,\n bottom\n ],\n [\n refRect.right - 1,\n top\n ],\n [\n rect.left + 1,\n top\n ],\n [\n rect.left + 1,\n bottom\n ]\n ];\n break;\n }\n function getPolygon(param2) {\n var [x2, y2] = param2;\n switch (side) {\n case \"top\": {\n var cursorPointOne = [\n isFloatingWider ? x2 + buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4,\n y2 + buffer + 1\n ];\n var cursorPointTwo = [\n isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4,\n y2 + buffer + 1\n ];\n var commonPoints = [\n [\n rect.left,\n cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top\n ],\n [\n rect.right,\n cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer\n ]\n ];\n return [\n cursorPointOne,\n cursorPointTwo,\n ...commonPoints\n ];\n }\n case \"bottom\": {\n var cursorPointOne1 = [\n isFloatingWider ? x2 + buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4,\n y2 - buffer\n ];\n var cursorPointTwo1 = [\n isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4,\n y2 - buffer\n ];\n var commonPoints1 = [\n [\n rect.left,\n cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom\n ],\n [\n rect.right,\n cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer\n ]\n ];\n return [\n cursorPointOne1,\n cursorPointTwo1,\n ...commonPoints1\n ];\n }\n case \"left\": {\n var cursorPointOne2 = [\n x2 + buffer + 1,\n isFloatingTaller ? y2 + buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4\n ];\n var cursorPointTwo2 = [\n x2 + buffer + 1,\n isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4\n ];\n var commonPoints2 = [\n [\n cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left,\n rect.top\n ],\n [\n cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer,\n rect.bottom\n ]\n ];\n return [\n ...commonPoints2,\n cursorPointOne2,\n cursorPointTwo2\n ];\n }\n case \"right\": {\n var cursorPointOne3 = [\n x2 - buffer,\n isFloatingTaller ? y2 + buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4\n ];\n var cursorPointTwo3 = [\n x2 - buffer,\n isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4\n ];\n var commonPoints3 = [\n [\n cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right,\n rect.top\n ],\n [\n cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer,\n rect.bottom\n ]\n ];\n return [\n cursorPointOne3,\n cursorPointTwo3,\n ...commonPoints3\n ];\n }\n }\n }\n var poly = getPolygon([\n x,\n y\n ]);\n if (__debug) {\n debugDrawPolygon(poly, rectPoly, clientPoint, [\n x,\n y\n ]);\n }\n if (isPointInPolygon([\n clientX,\n clientY\n ], rectPoly)) {\n return;\n }\n if (hasLanded && !isOverReferenceRect) {\n if (__debug) debugClear();\n return close();\n }\n if (isPointInPolygon([\n clientX,\n clientY\n ], poly)) {\n return;\n }\n if (!isLeave && requireIntent) {\n var cursorSpeed = getCursorSpeed(clientX, clientY);\n var cursorSpeedThreshold = 0.1;\n if (cursorSpeed !== null && cursorSpeed < cursorSpeedThreshold) {\n if (__debug) debugClear();\n return close();\n }\n }\n if (__debug) debugClear();\n close();\n };\n };\n fn.__options = {\n blockPointerEvents\n };\n return fn;\n}\n//# sourceMappingURL=safePolygon.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAA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AAK,SAAS,CAC/F;MACA,IAAI,gBAAgB,CAClB,CACE,wBAAwB,KAAK,OAAO,SAAS,mBAAmB,KAAK,OAAO,SAAS,KAAK,OAC1F,KAAK,GACP,GACA,CACE,wBAAwB,mBAAmB,KAAK,OAAO,SAAS,KAAK,QAAQ,KAAK,OAAO,QACzF,KAAK,MACP,CACF;MACA,OAAO;OACL;OACA;OACA,GAAG;MACL;KACF;IACF;GACF;GACA,IAAI,OAAO,WAAW,CACpB,GACA,CACF,CAAC;GACD,IAAI,SAAS;IACX,iBAAiB,MAAM,UAAU,aAAa,CAC5C,GACA,CACF,CAAC;GACH;GACA,IAAI,iBAAiB,CACnB,SACA,OACF,GAAG,QAAQ,GAAG;IACZ;GACF;GACA,IAAI,aAAa,CAAC,qBAAqB;IACrC,IAAI,SAAS,WAAW;IACxB,OAAO,MAAM;GACf;GACA,IAAI,iBAAiB,CACnB,SACA,OACF,GAAG,IAAI,GAAG;IACR;GACF;GACA,IAAI,CAAC,WAAW,eAAe;IAC7B,IAAI,cAAc,eAAe,SAAS,OAAO;IACjD,IAAI,uBAAuB;IAC3B,IAAI,gBAAgB,QAAQ,cAAc,sBAAsB;KAC9D,IAAI,SAAS,WAAW;KACxB,OAAO,MAAM;IACf;GACF;GACA,IAAI,SAAS,WAAW;GACxB,MAAM;EACR;CACF;CACA,GAAG,YAAY,EACb,mBACF;CACA,OAAO;AACT"}
|
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(useDelayGroup_exports);
|
|
|
36
36
|
var React = __toESM(require("react"), 1);
|
|
37
37
|
var DelayGroupContext = React.createContext({
|
|
38
38
|
currentId: null,
|
|
39
|
-
setCurrentId: function() {},
|
|
39
|
+
setCurrentId: function setCurrentId() {},
|
|
40
40
|
delay: 0,
|
|
41
41
|
timeoutMs: 0,
|
|
42
42
|
initialDelay: 0
|
|
@@ -48,7 +48,7 @@ function FloatingDelayGroup(param) {
|
|
|
48
48
|
var { children, delay, timeoutMs = 0 } = param;
|
|
49
49
|
var [currentId, setCurrentIdRaw] = React.useState(null);
|
|
50
50
|
var timeoutRef = React.useRef(void 0);
|
|
51
|
-
var
|
|
51
|
+
var setCurrentId2 = React.useCallback(function(id) {
|
|
52
52
|
clearTimeout(timeoutRef.current);
|
|
53
53
|
if (id == null && timeoutMs > 0) {
|
|
54
54
|
timeoutRef.current = setTimeout(function() {
|
|
@@ -66,14 +66,14 @@ function FloatingDelayGroup(param) {
|
|
|
66
66
|
var value = React.useMemo(function() {
|
|
67
67
|
return {
|
|
68
68
|
currentId,
|
|
69
|
-
setCurrentId,
|
|
69
|
+
setCurrentId: setCurrentId2,
|
|
70
70
|
delay,
|
|
71
71
|
timeoutMs,
|
|
72
72
|
initialDelay: delay
|
|
73
73
|
};
|
|
74
74
|
}, [
|
|
75
75
|
currentId,
|
|
76
|
-
|
|
76
|
+
setCurrentId2,
|
|
77
77
|
delay,
|
|
78
78
|
timeoutMs
|
|
79
79
|
]);
|
|
@@ -112,7 +112,7 @@ function useDelayGroup(context) {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
function getClose(delay) {
|
|
115
|
+
var _ref;
|
|
115
116
|
if (typeof delay === "number") return delay;
|
|
116
|
-
|
|
117
|
-
return (_delay_close = delay === null || delay === void 0 ? void 0 : delay.close) !== null && _delay_close !== void 0 ? _delay_close : 0;
|
|
117
|
+
return (_ref = delay === null || delay === void 0 ? void 0 : delay.close) !== null && _ref !== void 0 ? _ref : 0;
|
|
118
118
|
}
|
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(useDelayGroup_exports);
|
|
|
36
36
|
var React = __toESM(require("react"), 1);
|
|
37
37
|
var DelayGroupContext = React.createContext({
|
|
38
38
|
currentId: null,
|
|
39
|
-
setCurrentId: function() {},
|
|
39
|
+
setCurrentId: function setCurrentId() {},
|
|
40
40
|
delay: 0,
|
|
41
41
|
timeoutMs: 0,
|
|
42
42
|
initialDelay: 0
|
|
@@ -48,7 +48,7 @@ function FloatingDelayGroup(param) {
|
|
|
48
48
|
var { children, delay, timeoutMs = 0 } = param;
|
|
49
49
|
var [currentId, setCurrentIdRaw] = React.useState(null);
|
|
50
50
|
var timeoutRef = React.useRef(void 0);
|
|
51
|
-
var
|
|
51
|
+
var setCurrentId2 = React.useCallback(function(id) {
|
|
52
52
|
clearTimeout(timeoutRef.current);
|
|
53
53
|
if (id == null && timeoutMs > 0) {
|
|
54
54
|
timeoutRef.current = setTimeout(function() {
|
|
@@ -66,14 +66,14 @@ function FloatingDelayGroup(param) {
|
|
|
66
66
|
var value = React.useMemo(function() {
|
|
67
67
|
return {
|
|
68
68
|
currentId,
|
|
69
|
-
setCurrentId,
|
|
69
|
+
setCurrentId: setCurrentId2,
|
|
70
70
|
delay,
|
|
71
71
|
timeoutMs,
|
|
72
72
|
initialDelay: delay
|
|
73
73
|
};
|
|
74
74
|
}, [
|
|
75
75
|
currentId,
|
|
76
|
-
|
|
76
|
+
setCurrentId2,
|
|
77
77
|
delay,
|
|
78
78
|
timeoutMs
|
|
79
79
|
]);
|
|
@@ -112,9 +112,9 @@ function useDelayGroup(context) {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
function getClose(delay) {
|
|
115
|
+
var _ref;
|
|
115
116
|
if (typeof delay === "number") return delay;
|
|
116
|
-
|
|
117
|
-
return (_delay_close = delay === null || delay === void 0 ? void 0 : delay.close) !== null && _delay_close !== void 0 ? _delay_close : 0;
|
|
117
|
+
return (_ref = delay === null || delay === void 0 ? void 0 : delay.close) !== null && _ref !== void 0 ? _ref : 0;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
//# sourceMappingURL=useDelayGroup.native.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 setCurrentId() {\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 setCurrentId2 = 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: setCurrentId2,\n delay,\n timeoutMs,\n initialDelay: delay\n };\n }, [\n currentId,\n setCurrentId2,\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 var _ref;\n if (typeof delay === \"number\") return delay;\n return (_ref = delay === null || delay === void 0 ? void 0 : delay.close) !== null && _ref !== void 0 ? _ref : 0;\n}\n//# sourceMappingURL=useDelayGroup.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC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AS,KAAK,IAAI,OAAO;AACjH"}
|
|
@@ -153,7 +153,7 @@ function useListNavigation(context, props) {
|
|
|
153
153
|
}
|
|
154
154
|
if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {
|
|
155
155
|
var runs = 0;
|
|
156
|
-
var waitForListPopulated = function() {
|
|
156
|
+
var waitForListPopulated = function waitForListPopulated1() {
|
|
157
157
|
if (listRef.current[0] == null) {
|
|
158
158
|
if (runs < 2) {
|
|
159
159
|
var scheduler = runs ? requestAnimationFrame : queueMicrotask;
|
|
@@ -394,7 +394,7 @@ function useListNavigation(context, props) {
|
|
|
394
394
|
forceSyncFocusRef.current = true;
|
|
395
395
|
syncCurrentTarget(currentTarget);
|
|
396
396
|
},
|
|
397
|
-
onClick: function(param) {
|
|
397
|
+
onClick: function onClick(param) {
|
|
398
398
|
var { currentTarget } = param;
|
|
399
399
|
return currentTarget.focus({ preventScroll: true });
|
|
400
400
|
},
|
|
@@ -153,7 +153,7 @@ function useListNavigation(context, props) {
|
|
|
153
153
|
}
|
|
154
154
|
if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {
|
|
155
155
|
var runs = 0;
|
|
156
|
-
var waitForListPopulated = function() {
|
|
156
|
+
var waitForListPopulated = function waitForListPopulated1() {
|
|
157
157
|
if (listRef.current[0] == null) {
|
|
158
158
|
if (runs < 2) {
|
|
159
159
|
var scheduler = runs ? requestAnimationFrame : queueMicrotask;
|
|
@@ -394,7 +394,7 @@ function useListNavigation(context, props) {
|
|
|
394
394
|
forceSyncFocusRef.current = true;
|
|
395
395
|
syncCurrentTarget(currentTarget);
|
|
396
396
|
},
|
|
397
|
-
onClick: function(param) {
|
|
397
|
+
onClick: function onClick(param) {
|
|
398
398
|
var { currentTarget } = param;
|
|
399
399
|
return currentTarget.focus({ preventScroll: true });
|
|
400
400
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListNavigation.native.js","names":[],"sources":["cjs/interactions/useListNavigation.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useListNavigation_exports = {};\n__export(useListNavigation_exports, {\n useListNavigation: () => useListNavigation\n});\nmodule.exports = __toCommonJS(useListNavigation_exports);\nvar import_react = require(\"react\");\nvar import_use_event = require(\"@tamagui/use-event\");\nvar import_utils = require(\"./utils\");\nvar ARROW_UP = \"ArrowUp\";\nvar ARROW_DOWN = \"ArrowDown\";\nvar ARROW_LEFT = \"ArrowLeft\";\nvar ARROW_RIGHT = \"ArrowRight\";\nfunction doSwitch(orientation, vertical, horizontal) {\n switch (orientation) {\n case \"vertical\":\n return vertical;\n case \"horizontal\":\n return horizontal;\n default:\n return vertical || horizontal;\n }\n}\nfunction isMainOrientationKey(key, orientation) {\n var vertical = key === ARROW_UP || key === ARROW_DOWN;\n var horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n var vertical = key === ARROW_DOWN;\n var horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal) || key === \"Enter\" || key === \" \" || key === \"\";\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n var vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n var horizontal = key === ARROW_DOWN;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl) {\n var vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n var horizontal = key === ARROW_UP;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction useListNavigation(context, props) {\n var { open, onOpenChange, elements } = context;\n var { listRef, activeIndex, onNavigate: unstable_onNavigate = function() {\n }, enabled = true, selectedIndex = null, allowEscape = false, loop = false, nested = false, rtl = false, virtual = false, focusItemOnOpen = \"auto\", focusItemOnHover = true, openOnArrowKeyDown = true, disabledIndices = void 0, orientation = \"vertical\", scrollItemIntoView = true } = props;\n var typeableComboboxReference = (0, import_utils.isTypeableCombobox)(elements.domReference);\n var focusItemOnOpenRef = (0, import_react.useRef)(focusItemOnOpen);\n var indexRef = (0, import_react.useRef)(selectedIndex !== null && selectedIndex !== void 0 ? selectedIndex : -1);\n var keyRef = (0, import_react.useRef)(null);\n var isPointerModalityRef = (0, import_react.useRef)(true);\n var previousMountedRef = (0, import_react.useRef)(!!elements.floating);\n var previousOpenRef = (0, import_react.useRef)(open);\n var forceSyncFocusRef = (0, import_react.useRef)(false);\n var forceScrollIntoViewRef = (0, import_react.useRef)(false);\n var disabledIndicesRef = (0, import_react.useRef)(disabledIndices);\n disabledIndicesRef.current = disabledIndices;\n var latestOpenRef = (0, import_react.useRef)(open);\n latestOpenRef.current = open;\n var scrollItemIntoViewRef = (0, import_react.useRef)(scrollItemIntoView);\n scrollItemIntoViewRef.current = scrollItemIntoView;\n var selectedIndexRef = (0, import_react.useRef)(selectedIndex);\n selectedIndexRef.current = selectedIndex;\n var stableOnNavigate = (0, import_use_event.useEvent)(unstable_onNavigate);\n var [activeId, setActiveId] = (0, import_react.useState)();\n var onNavigate = (0, import_use_event.useEvent)(function() {\n stableOnNavigate(indexRef.current === -1 ? null : indexRef.current);\n });\n var previousOnNavigateRef = (0, import_react.useRef)(onNavigate);\n var focusItem = (0, import_use_event.useEvent)(function() {\n function runFocus(item2) {\n if (virtual) {\n setActiveId(item2.id);\n } else {\n (0, import_utils.enqueueFocus)(item2, {\n sync: forceSyncFocusRef.current,\n preventScroll: true\n });\n }\n }\n var initialItem = listRef.current[indexRef.current];\n var forceScrollIntoView = forceScrollIntoViewRef.current;\n if (initialItem) {\n runFocus(initialItem);\n }\n var scheduler = forceSyncFocusRef.current ? function(v) {\n return v();\n } : requestAnimationFrame;\n scheduler(function() {\n var waitedItem = listRef.current[indexRef.current] || initialItem;\n if (!waitedItem) return;\n if (!initialItem) {\n runFocus(waitedItem);\n }\n var scrollIntoViewOptions = scrollItemIntoViewRef.current;\n var shouldScrollIntoView = scrollIntoViewOptions && waitedItem && (forceScrollIntoView || !isPointerModalityRef.current);\n if (shouldScrollIntoView) {\n var _waitedItem_scrollIntoView;\n (_waitedItem_scrollIntoView = waitedItem.scrollIntoView) === null || _waitedItem_scrollIntoView === void 0 ? void 0 : _waitedItem_scrollIntoView.call(waitedItem, typeof scrollIntoViewOptions === \"boolean\" ? {\n block: \"nearest\",\n inline: \"nearest\"\n } : scrollIntoViewOptions);\n }\n });\n });\n (0, import_react.useLayoutEffect)(function() {\n if (!enabled) return;\n if (open && elements.floating) {\n if (focusItemOnOpenRef.current && selectedIndex != null) {\n forceScrollIntoViewRef.current = true;\n indexRef.current = selectedIndex;\n onNavigate();\n }\n } else if (previousMountedRef.current) {\n indexRef.current = -1;\n previousOnNavigateRef.current();\n }\n }, [\n enabled,\n open,\n elements.floating,\n selectedIndex,\n onNavigate\n ]);\n (0, import_react.useLayoutEffect)(function() {\n if (!enabled) return;\n if (!open) return;\n if (!elements.floating) return;\n if (activeIndex == null) {\n forceSyncFocusRef.current = false;\n if (selectedIndexRef.current != null) {\n return;\n }\n if (previousMountedRef.current) {\n indexRef.current = -1;\n focusItem();\n }\n if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n var runs = 0;\n var waitForListPopulated = function() {\n if (listRef.current[0] == null) {\n if (runs < 2) {\n var scheduler = runs ? requestAnimationFrame : queueMicrotask;\n scheduler(waitForListPopulated);\n }\n runs++;\n } else {\n indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? (0, import_utils.getMinListIndex)(listRef, disabledIndicesRef.current) : (0, import_utils.getMaxListIndex)(listRef, disabledIndicesRef.current);\n keyRef.current = null;\n onNavigate();\n }\n };\n waitForListPopulated();\n }\n } else if (!(0, import_utils.isIndexOutOfListBounds)(listRef, activeIndex)) {\n indexRef.current = activeIndex;\n focusItem();\n forceScrollIntoViewRef.current = false;\n }\n }, [\n enabled,\n open,\n elements.floating,\n activeIndex,\n selectedIndexRef,\n nested,\n listRef,\n orientation,\n rtl,\n onNavigate,\n focusItem,\n disabledIndicesRef\n ]);\n (0, import_react.useLayoutEffect)(function() {\n previousOnNavigateRef.current = onNavigate;\n previousOpenRef.current = open;\n previousMountedRef.current = !!elements.floating;\n });\n (0, import_react.useLayoutEffect)(function() {\n if (!open) {\n keyRef.current = null;\n focusItemOnOpenRef.current = focusItemOnOpen;\n }\n }, [\n open,\n focusItemOnOpen\n ]);\n var hasActiveIndex = activeIndex != null;\n var commonOnKeyDown = (0, import_use_event.useEvent)(function(event) {\n isPointerModalityRef.current = false;\n forceSyncFocusRef.current = true;\n if (event.which === 229) {\n return;\n }\n if (!latestOpenRef.current && event.currentTarget === elements.floating) {\n return;\n }\n if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl)) {\n (0, import_utils.stopEvent)(event);\n onOpenChange(false, event.nativeEvent, \"list-navigation\");\n if ((0, import_utils.isHTMLElement)(elements.domReference)) {\n elements.domReference.focus();\n }\n return;\n }\n var currentIndex = indexRef.current;\n var minIndex = (0, import_utils.getMinListIndex)(listRef, disabledIndices);\n var maxIndex = (0, import_utils.getMaxListIndex)(listRef, disabledIndices);\n if (!typeableComboboxReference) {\n if (event.key === \"Home\") {\n (0, import_utils.stopEvent)(event);\n indexRef.current = minIndex;\n onNavigate();\n }\n if (event.key === \"End\") {\n (0, import_utils.stopEvent)(event);\n indexRef.current = maxIndex;\n onNavigate();\n }\n }\n if (isMainOrientationKey(event.key, orientation)) {\n (0, import_utils.stopEvent)(event);\n if (open && !virtual && (0, import_utils.activeElement)(event.currentTarget.ownerDocument) === event.currentTarget) {\n indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n onNavigate();\n return;\n }\n if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n if (loop) {\n indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : (0, import_utils.findNonDisabledListIndex)(listRef, {\n startingIndex: currentIndex,\n disabledIndices\n });\n } else {\n indexRef.current = Math.min(maxIndex, (0, import_utils.findNonDisabledListIndex)(listRef, {\n startingIndex: currentIndex,\n disabledIndices\n }));\n }\n } else {\n if (loop) {\n indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : (0, import_utils.findNonDisabledListIndex)(listRef, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n });\n } else {\n indexRef.current = Math.max(minIndex, (0, import_utils.findNonDisabledListIndex)(listRef, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n }));\n }\n }\n if ((0, import_utils.isIndexOutOfListBounds)(listRef, indexRef.current)) {\n indexRef.current = -1;\n }\n onNavigate();\n }\n });\n var ariaActiveDescendantProp = (0, import_react.useMemo)(function() {\n return virtual && open && hasActiveIndex && {\n \"aria-activedescendant\": activeId\n };\n }, [\n virtual,\n open,\n hasActiveIndex,\n activeId\n ]);\n var floating = (0, import_react.useMemo)(function() {\n return {\n \"aria-orientation\": orientation === \"both\" ? void 0 : orientation,\n ...!typeableComboboxReference ? ariaActiveDescendantProp : {},\n onKeyDown: commonOnKeyDown,\n onPointerMove() {\n isPointerModalityRef.current = true;\n }\n };\n }, [\n ariaActiveDescendantProp,\n commonOnKeyDown,\n orientation,\n typeableComboboxReference\n ]);\n var reference = (0, import_react.useMemo)(function() {\n function checkVirtualMouse(event) {\n if (focusItemOnOpen === \"auto\" && (0, import_utils.isVirtualClick)(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n function checkVirtualPointer(event) {\n focusItemOnOpenRef.current = focusItemOnOpen;\n if (focusItemOnOpen === \"auto\" && (0, import_utils.isVirtualPointerEvent)(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n return {\n ...ariaActiveDescendantProp,\n onKeyDown(event) {\n isPointerModalityRef.current = false;\n var isArrowKey = event.key.startsWith(\"Arrow\");\n var isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl);\n var isMainKey = isMainOrientationKey(event.key, orientation);\n var isNavigationKey = (nested ? isCrossOpenKey : isMainKey) || event.key === \"Enter\" || event.key.trim() === \"\";\n if (virtual && open) {\n return commonOnKeyDown(event);\n }\n if (!open && !openOnArrowKeyDown && isArrowKey) {\n return;\n }\n if (isNavigationKey) {\n keyRef.current = event.key;\n }\n if (nested) {\n if (isCrossOpenKey) {\n (0, import_utils.stopEvent)(event);\n if (open) {\n indexRef.current = (0, import_utils.getMinListIndex)(listRef, disabledIndicesRef.current);\n onNavigate();\n } else {\n onOpenChange(true, event.nativeEvent, \"list-navigation\");\n }\n }\n return;\n }\n if (isMainKey) {\n if (selectedIndex != null) {\n indexRef.current = selectedIndex;\n }\n (0, import_utils.stopEvent)(event);\n if (!open && openOnArrowKeyDown) {\n onOpenChange(true, event.nativeEvent, \"list-navigation\");\n } else {\n commonOnKeyDown(event);\n }\n if (open) {\n onNavigate();\n }\n }\n },\n onFocus() {\n if (open && !virtual) {\n indexRef.current = -1;\n onNavigate();\n }\n },\n onPointerDown: checkVirtualPointer,\n onPointerEnter: checkVirtualPointer,\n onMouseDown: checkVirtualMouse,\n onClick: checkVirtualMouse\n };\n }, [\n ariaActiveDescendantProp,\n commonOnKeyDown,\n disabledIndicesRef,\n focusItemOnOpen,\n listRef,\n nested,\n onNavigate,\n onOpenChange,\n open,\n openOnArrowKeyDown,\n orientation,\n rtl,\n selectedIndex,\n virtual\n ]);\n var floatingRef = (0, import_react.useRef)(elements.floating);\n floatingRef.current = elements.floating;\n var item = (0, import_react.useMemo)(function() {\n function syncCurrentTarget(currentTarget) {\n if (!latestOpenRef.current) return;\n var index = listRef.current.indexOf(currentTarget);\n if (index !== -1 && indexRef.current !== index) {\n indexRef.current = index;\n onNavigate();\n }\n }\n var itemProps = {\n onFocus(param) {\n var { currentTarget } = param;\n forceSyncFocusRef.current = true;\n syncCurrentTarget(currentTarget);\n },\n onClick: function(param) {\n var { currentTarget } = param;\n return currentTarget.focus({\n preventScroll: true\n });\n },\n // safari\n onMouseMove(param) {\n var { currentTarget } = param;\n forceSyncFocusRef.current = true;\n forceScrollIntoViewRef.current = false;\n if (focusItemOnHover) {\n syncCurrentTarget(currentTarget);\n }\n },\n onPointerLeave(param) {\n var { pointerType } = param;\n if (!isPointerModalityRef.current || pointerType === \"touch\") {\n return;\n }\n forceSyncFocusRef.current = true;\n if (!focusItemOnHover) {\n return;\n }\n indexRef.current = -1;\n onNavigate();\n if (!virtual) {\n var _floatingRef_current;\n (_floatingRef_current = floatingRef.current) === null || _floatingRef_current === void 0 ? void 0 : _floatingRef_current.focus({\n preventScroll: true\n });\n }\n }\n };\n return itemProps;\n }, [\n latestOpenRef,\n focusItemOnHover,\n listRef,\n onNavigate,\n virtual\n ]);\n return (0, import_react.useMemo)(function() {\n return enabled ? {\n reference,\n floating,\n item\n } : {};\n }, [\n enabled,\n reference,\n floating,\n item\n ]);\n}\n//# sourceMappingURL=useListNavigation.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,O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O;IACjB,IAAI,EAAE,kBAAkB;IACxB,kBAAkB,UAAU;IAC5B,uBAAuB,UAAU;IACjC,IAAI,kBAAkB;KACpB,kBAAkB,aAAa;IACjC;GACF;GACA,eAAe,OAAO;IACpB,IAAI,EAAE,gBAAgB;IACtB,IAAI,CAAC,qBAAqB,WAAW,gBAAgB,SAAS;KAC5D;IACF;IACA,kBAAkB,UAAU;IAC5B,IAAI,CAAC,kBAAkB;KACrB;IACF;IACA,SAAS,UAAU,CAAC;IACpB,WAAW;IACX,IAAI,CAAC,SAAS;KACZ,IAAI;KACJ,CAAC,uBAAuB,YAAY,aAAa,QAAQ,yBAAyB,KAAK,IAAI,KAAK,IAAI,qBAAqB,MAAM,EAC7H,eAAe,KACjB,CAAC;IACH;GACF;EACF;EACA,OAAO;CACT,GAAG;EACD;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,QAAQ,GAAG,aAAa,QAAO,CAAE,WAAW;EAC1C,OAAO,UAAU;GACf;GACA;GACA;EACF,IAAI,CAAC;CACP,GAAG;EACD;EACA;EACA;EACA;CACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"useListNavigation.native.js","names":[],"sources":["cjs/interactions/useListNavigation.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useListNavigation_exports = {};\n__export(useListNavigation_exports, {\n useListNavigation: () => useListNavigation\n});\nmodule.exports = __toCommonJS(useListNavigation_exports);\nvar import_react = require(\"react\");\nvar import_use_event = require(\"@tamagui/use-event\");\nvar import_utils = require(\"./utils\");\nvar ARROW_UP = \"ArrowUp\";\nvar ARROW_DOWN = \"ArrowDown\";\nvar ARROW_LEFT = \"ArrowLeft\";\nvar ARROW_RIGHT = \"ArrowRight\";\nfunction doSwitch(orientation, vertical, horizontal) {\n switch (orientation) {\n case \"vertical\":\n return vertical;\n case \"horizontal\":\n return horizontal;\n default:\n return vertical || horizontal;\n }\n}\nfunction isMainOrientationKey(key, orientation) {\n var vertical = key === ARROW_UP || key === ARROW_DOWN;\n var horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n var vertical = key === ARROW_DOWN;\n var horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal) || key === \"Enter\" || key === \" \" || key === \"\";\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n var vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n var horizontal = key === ARROW_DOWN;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl) {\n var vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n var horizontal = key === ARROW_UP;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction useListNavigation(context, props) {\n var { open, onOpenChange, elements } = context;\n var { listRef, activeIndex, onNavigate: unstable_onNavigate = function() {\n }, enabled = true, selectedIndex = null, allowEscape = false, loop = false, nested = false, rtl = false, virtual = false, focusItemOnOpen = \"auto\", focusItemOnHover = true, openOnArrowKeyDown = true, disabledIndices = void 0, orientation = \"vertical\", scrollItemIntoView = true } = props;\n var typeableComboboxReference = (0, import_utils.isTypeableCombobox)(elements.domReference);\n var focusItemOnOpenRef = (0, import_react.useRef)(focusItemOnOpen);\n var indexRef = (0, import_react.useRef)(selectedIndex !== null && selectedIndex !== void 0 ? selectedIndex : -1);\n var keyRef = (0, import_react.useRef)(null);\n var isPointerModalityRef = (0, import_react.useRef)(true);\n var previousMountedRef = (0, import_react.useRef)(!!elements.floating);\n var previousOpenRef = (0, import_react.useRef)(open);\n var forceSyncFocusRef = (0, import_react.useRef)(false);\n var forceScrollIntoViewRef = (0, import_react.useRef)(false);\n var disabledIndicesRef = (0, import_react.useRef)(disabledIndices);\n disabledIndicesRef.current = disabledIndices;\n var latestOpenRef = (0, import_react.useRef)(open);\n latestOpenRef.current = open;\n var scrollItemIntoViewRef = (0, import_react.useRef)(scrollItemIntoView);\n scrollItemIntoViewRef.current = scrollItemIntoView;\n var selectedIndexRef = (0, import_react.useRef)(selectedIndex);\n selectedIndexRef.current = selectedIndex;\n var stableOnNavigate = (0, import_use_event.useEvent)(unstable_onNavigate);\n var [activeId, setActiveId] = (0, import_react.useState)();\n var onNavigate = (0, import_use_event.useEvent)(function() {\n stableOnNavigate(indexRef.current === -1 ? null : indexRef.current);\n });\n var previousOnNavigateRef = (0, import_react.useRef)(onNavigate);\n var focusItem = (0, import_use_event.useEvent)(function() {\n function runFocus(item2) {\n if (virtual) {\n setActiveId(item2.id);\n } else {\n (0, import_utils.enqueueFocus)(item2, {\n sync: forceSyncFocusRef.current,\n preventScroll: true\n });\n }\n }\n var initialItem = listRef.current[indexRef.current];\n var forceScrollIntoView = forceScrollIntoViewRef.current;\n if (initialItem) {\n runFocus(initialItem);\n }\n var scheduler = forceSyncFocusRef.current ? function(v) {\n return v();\n } : requestAnimationFrame;\n scheduler(function() {\n var waitedItem = listRef.current[indexRef.current] || initialItem;\n if (!waitedItem) return;\n if (!initialItem) {\n runFocus(waitedItem);\n }\n var scrollIntoViewOptions = scrollItemIntoViewRef.current;\n var shouldScrollIntoView = scrollIntoViewOptions && waitedItem && (forceScrollIntoView || !isPointerModalityRef.current);\n if (shouldScrollIntoView) {\n var _waitedItem_scrollIntoView;\n (_waitedItem_scrollIntoView = waitedItem.scrollIntoView) === null || _waitedItem_scrollIntoView === void 0 ? void 0 : _waitedItem_scrollIntoView.call(waitedItem, typeof scrollIntoViewOptions === \"boolean\" ? {\n block: \"nearest\",\n inline: \"nearest\"\n } : scrollIntoViewOptions);\n }\n });\n });\n (0, import_react.useLayoutEffect)(function() {\n if (!enabled) return;\n if (open && elements.floating) {\n if (focusItemOnOpenRef.current && selectedIndex != null) {\n forceScrollIntoViewRef.current = true;\n indexRef.current = selectedIndex;\n onNavigate();\n }\n } else if (previousMountedRef.current) {\n indexRef.current = -1;\n previousOnNavigateRef.current();\n }\n }, [\n enabled,\n open,\n elements.floating,\n selectedIndex,\n onNavigate\n ]);\n (0, import_react.useLayoutEffect)(function() {\n if (!enabled) return;\n if (!open) return;\n if (!elements.floating) return;\n if (activeIndex == null) {\n forceSyncFocusRef.current = false;\n if (selectedIndexRef.current != null) {\n return;\n }\n if (previousMountedRef.current) {\n indexRef.current = -1;\n focusItem();\n }\n if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n var runs = 0;\n var waitForListPopulated = function waitForListPopulated1() {\n if (listRef.current[0] == null) {\n if (runs < 2) {\n var scheduler = runs ? requestAnimationFrame : queueMicrotask;\n scheduler(waitForListPopulated);\n }\n runs++;\n } else {\n indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? (0, import_utils.getMinListIndex)(listRef, disabledIndicesRef.current) : (0, import_utils.getMaxListIndex)(listRef, disabledIndicesRef.current);\n keyRef.current = null;\n onNavigate();\n }\n };\n waitForListPopulated();\n }\n } else if (!(0, import_utils.isIndexOutOfListBounds)(listRef, activeIndex)) {\n indexRef.current = activeIndex;\n focusItem();\n forceScrollIntoViewRef.current = false;\n }\n }, [\n enabled,\n open,\n elements.floating,\n activeIndex,\n selectedIndexRef,\n nested,\n listRef,\n orientation,\n rtl,\n onNavigate,\n focusItem,\n disabledIndicesRef\n ]);\n (0, import_react.useLayoutEffect)(function() {\n previousOnNavigateRef.current = onNavigate;\n previousOpenRef.current = open;\n previousMountedRef.current = !!elements.floating;\n });\n (0, import_react.useLayoutEffect)(function() {\n if (!open) {\n keyRef.current = null;\n focusItemOnOpenRef.current = focusItemOnOpen;\n }\n }, [\n open,\n focusItemOnOpen\n ]);\n var hasActiveIndex = activeIndex != null;\n var commonOnKeyDown = (0, import_use_event.useEvent)(function(event) {\n isPointerModalityRef.current = false;\n forceSyncFocusRef.current = true;\n if (event.which === 229) {\n return;\n }\n if (!latestOpenRef.current && event.currentTarget === elements.floating) {\n return;\n }\n if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl)) {\n (0, import_utils.stopEvent)(event);\n onOpenChange(false, event.nativeEvent, \"list-navigation\");\n if ((0, import_utils.isHTMLElement)(elements.domReference)) {\n elements.domReference.focus();\n }\n return;\n }\n var currentIndex = indexRef.current;\n var minIndex = (0, import_utils.getMinListIndex)(listRef, disabledIndices);\n var maxIndex = (0, import_utils.getMaxListIndex)(listRef, disabledIndices);\n if (!typeableComboboxReference) {\n if (event.key === \"Home\") {\n (0, import_utils.stopEvent)(event);\n indexRef.current = minIndex;\n onNavigate();\n }\n if (event.key === \"End\") {\n (0, import_utils.stopEvent)(event);\n indexRef.current = maxIndex;\n onNavigate();\n }\n }\n if (isMainOrientationKey(event.key, orientation)) {\n (0, import_utils.stopEvent)(event);\n if (open && !virtual && (0, import_utils.activeElement)(event.currentTarget.ownerDocument) === event.currentTarget) {\n indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n onNavigate();\n return;\n }\n if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n if (loop) {\n indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : (0, import_utils.findNonDisabledListIndex)(listRef, {\n startingIndex: currentIndex,\n disabledIndices\n });\n } else {\n indexRef.current = Math.min(maxIndex, (0, import_utils.findNonDisabledListIndex)(listRef, {\n startingIndex: currentIndex,\n disabledIndices\n }));\n }\n } else {\n if (loop) {\n indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : (0, import_utils.findNonDisabledListIndex)(listRef, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n });\n } else {\n indexRef.current = Math.max(minIndex, (0, import_utils.findNonDisabledListIndex)(listRef, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n }));\n }\n }\n if ((0, import_utils.isIndexOutOfListBounds)(listRef, indexRef.current)) {\n indexRef.current = -1;\n }\n onNavigate();\n }\n });\n var ariaActiveDescendantProp = (0, import_react.useMemo)(function() {\n return virtual && open && hasActiveIndex && {\n \"aria-activedescendant\": activeId\n };\n }, [\n virtual,\n open,\n hasActiveIndex,\n activeId\n ]);\n var floating = (0, import_react.useMemo)(function() {\n return {\n \"aria-orientation\": orientation === \"both\" ? void 0 : orientation,\n ...!typeableComboboxReference ? ariaActiveDescendantProp : {},\n onKeyDown: commonOnKeyDown,\n onPointerMove() {\n isPointerModalityRef.current = true;\n }\n };\n }, [\n ariaActiveDescendantProp,\n commonOnKeyDown,\n orientation,\n typeableComboboxReference\n ]);\n var reference = (0, import_react.useMemo)(function() {\n function checkVirtualMouse(event) {\n if (focusItemOnOpen === \"auto\" && (0, import_utils.isVirtualClick)(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n function checkVirtualPointer(event) {\n focusItemOnOpenRef.current = focusItemOnOpen;\n if (focusItemOnOpen === \"auto\" && (0, import_utils.isVirtualPointerEvent)(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n return {\n ...ariaActiveDescendantProp,\n onKeyDown(event) {\n isPointerModalityRef.current = false;\n var isArrowKey = event.key.startsWith(\"Arrow\");\n var isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl);\n var isMainKey = isMainOrientationKey(event.key, orientation);\n var isNavigationKey = (nested ? isCrossOpenKey : isMainKey) || event.key === \"Enter\" || event.key.trim() === \"\";\n if (virtual && open) {\n return commonOnKeyDown(event);\n }\n if (!open && !openOnArrowKeyDown && isArrowKey) {\n return;\n }\n if (isNavigationKey) {\n keyRef.current = event.key;\n }\n if (nested) {\n if (isCrossOpenKey) {\n (0, import_utils.stopEvent)(event);\n if (open) {\n indexRef.current = (0, import_utils.getMinListIndex)(listRef, disabledIndicesRef.current);\n onNavigate();\n } else {\n onOpenChange(true, event.nativeEvent, \"list-navigation\");\n }\n }\n return;\n }\n if (isMainKey) {\n if (selectedIndex != null) {\n indexRef.current = selectedIndex;\n }\n (0, import_utils.stopEvent)(event);\n if (!open && openOnArrowKeyDown) {\n onOpenChange(true, event.nativeEvent, \"list-navigation\");\n } else {\n commonOnKeyDown(event);\n }\n if (open) {\n onNavigate();\n }\n }\n },\n onFocus() {\n if (open && !virtual) {\n indexRef.current = -1;\n onNavigate();\n }\n },\n onPointerDown: checkVirtualPointer,\n onPointerEnter: checkVirtualPointer,\n onMouseDown: checkVirtualMouse,\n onClick: checkVirtualMouse\n };\n }, [\n ariaActiveDescendantProp,\n commonOnKeyDown,\n disabledIndicesRef,\n focusItemOnOpen,\n listRef,\n nested,\n onNavigate,\n onOpenChange,\n open,\n openOnArrowKeyDown,\n orientation,\n rtl,\n selectedIndex,\n virtual\n ]);\n var floatingRef = (0, import_react.useRef)(elements.floating);\n floatingRef.current = elements.floating;\n var item = (0, import_react.useMemo)(function() {\n function syncCurrentTarget(currentTarget) {\n if (!latestOpenRef.current) return;\n var index = listRef.current.indexOf(currentTarget);\n if (index !== -1 && indexRef.current !== index) {\n indexRef.current = index;\n onNavigate();\n }\n }\n var itemProps = {\n onFocus(param) {\n var { currentTarget } = param;\n forceSyncFocusRef.current = true;\n syncCurrentTarget(currentTarget);\n },\n onClick: function onClick(param) {\n var { currentTarget } = param;\n return currentTarget.focus({\n preventScroll: true\n });\n },\n // safari\n onMouseMove(param) {\n var { currentTarget } = param;\n forceSyncFocusRef.current = true;\n forceScrollIntoViewRef.current = false;\n if (focusItemOnHover) {\n syncCurrentTarget(currentTarget);\n }\n },\n onPointerLeave(param) {\n var { pointerType } = param;\n if (!isPointerModalityRef.current || pointerType === \"touch\") {\n return;\n }\n forceSyncFocusRef.current = true;\n if (!focusItemOnHover) {\n return;\n }\n indexRef.current = -1;\n onNavigate();\n if (!virtual) {\n var _floatingRef_current;\n (_floatingRef_current = floatingRef.current) === null || _floatingRef_current === void 0 ? void 0 : _floatingRef_current.focus({\n preventScroll: true\n });\n }\n }\n };\n return itemProps;\n }, [\n latestOpenRef,\n focusItemOnHover,\n listRef,\n onNavigate,\n virtual\n ]);\n return (0, import_react.useMemo)(function() {\n return enabled ? {\n reference,\n floating,\n item\n } : {};\n }, [\n enabled,\n reference,\n floating,\n item\n ]);\n}\n//# sourceMappingURL=useListNavigation.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC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aAAa,QAAO,CAAE,WAAW;EAC1C,OAAO,UAAU;GACf;GACA;GACA;EACF,IAAI,CAAC;CACP,GAAG;EACD;EACA;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -38,6 +38,7 @@ var componentRoleToAriaRoleMap = /* @__PURE__ */ new Map([
|
|
|
38
38
|
var idCounter = 0;
|
|
39
39
|
function useRole(context) {
|
|
40
40
|
var props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
41
|
+
var _componentRoleToAriaRoleMap_get;
|
|
41
42
|
var _elements_domReference;
|
|
42
43
|
var { open, elements } = context;
|
|
43
44
|
var { enabled = true, role = "dialog" } = props;
|
|
@@ -50,7 +51,6 @@ function useRole(context) {
|
|
|
50
51
|
var _elements_floating;
|
|
51
52
|
return ((_elements_floating = elements.floating) === null || _elements_floating === void 0 ? void 0 : _elements_floating.id) || defaultFloatingId;
|
|
52
53
|
}, [elements.floating, defaultFloatingId]);
|
|
53
|
-
var _componentRoleToAriaRoleMap_get;
|
|
54
54
|
var ariaRole = (_componentRoleToAriaRoleMap_get = componentRoleToAriaRoleMap.get(role)) !== null && _componentRoleToAriaRoleMap_get !== void 0 ? _componentRoleToAriaRoleMap_get : role;
|
|
55
55
|
var reference = React.useMemo(function() {
|
|
56
56
|
if (ariaRole === "tooltip" || role === "label") {
|
|
@@ -38,6 +38,7 @@ var componentRoleToAriaRoleMap = /* @__PURE__ */ new Map([
|
|
|
38
38
|
var idCounter = 0;
|
|
39
39
|
function useRole(context) {
|
|
40
40
|
var props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
41
|
+
var _componentRoleToAriaRoleMap_get;
|
|
41
42
|
var _elements_domReference;
|
|
42
43
|
var { open, elements } = context;
|
|
43
44
|
var { enabled = true, role = "dialog" } = props;
|
|
@@ -50,7 +51,6 @@ function useRole(context) {
|
|
|
50
51
|
var _elements_floating;
|
|
51
52
|
return ((_elements_floating = elements.floating) === null || _elements_floating === void 0 ? void 0 : _elements_floating.id) || defaultFloatingId;
|
|
52
53
|
}, [elements.floating, defaultFloatingId]);
|
|
53
|
-
var _componentRoleToAriaRoleMap_get;
|
|
54
54
|
var ariaRole = (_componentRoleToAriaRoleMap_get = componentRoleToAriaRoleMap.get(role)) !== null && _componentRoleToAriaRoleMap_get !== void 0 ? _componentRoleToAriaRoleMap_get : role;
|
|
55
55
|
var reference = React.useMemo(function() {
|
|
56
56
|
if (ariaRole === "tooltip" || role === "label") {
|