@tamagui/floating 3.0.0-beta.924.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/interactions/useInteractions.cjs +35 -45
- package/dist/cjs/interactions/useInteractions.native.cjs +101 -100
- package/dist/cjs/interactions/useInteractions.native.js +101 -100
- package/dist/cjs/interactions/useInteractions.native.js.map +1 -1
- package/dist/cjs/interactions/useListNavigation.cjs +4 -3
- package/dist/cjs/interactions/useListNavigation.native.cjs +5 -4
- package/dist/cjs/interactions/useListNavigation.native.js +5 -4
- package/dist/cjs/interactions/useListNavigation.native.js.map +1 -1
- package/dist/cjs/interactions/utils.native.cjs +3 -10
- package/dist/cjs/interactions/utils.native.js +3 -10
- package/dist/cjs/interactions/utils.native.js.map +1 -1
- package/dist/esm/interactions/useInteractions.mjs +36 -45
- package/dist/esm/interactions/useInteractions.mjs.map +1 -1
- package/dist/esm/interactions/useInteractions.native.js +102 -100
- package/dist/esm/interactions/useInteractions.native.js.map +1 -1
- package/dist/esm/interactions/useListNavigation.mjs +4 -3
- package/dist/esm/interactions/useListNavigation.mjs.map +1 -1
- package/dist/esm/interactions/useListNavigation.native.js +5 -4
- package/dist/esm/interactions/useListNavigation.native.js.map +1 -1
- package/dist/esm/interactions/utils.native.js +3 -10
- package/dist/esm/interactions/utils.native.js.map +1 -1
- package/package.json +7 -5
- package/src/interactions/useInteractions.ts +61 -59
- package/src/interactions/useListNavigation.ts +7 -2
- package/types/interactions/useInteractions.d.ts +3 -3
- package/types/interactions/useInteractions.d.ts.map +1 -1
- package/types/interactions/useListNavigation.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInteractions.native.js","names":[],"sources":["cjs/interactions/useInteractions.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 useInteractions_exports = {};\n__export(useInteractions_exports, {\n useInteractions: () => useInteractions\n});\nmodule.exports = __toCommonJS(useInteractions_exports);\nfunction _type_of(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nfunction useInteractions(propsList) {\n var filtered = propsList.filter(Boolean);\n var referenceFns = /* @__PURE__ */ new Map();\n var floatingFns = /* @__PURE__ */ new Map();\n var itemFns = /* @__PURE__ */ new Map();\n var referenceStatic = {};\n var floatingStatic = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = filtered[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var props = _step.value;\n if (props.reference) {\n collectProps(props.reference, referenceFns, referenceStatic);\n }\n if (props.floating) {\n collectProps(props.floating, floatingFns, floatingStatic);\n }\n if (props.item && _type_of(props.item) === \"object\") {\n collectProps(props.item, itemFns, {});\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return {\n getReferenceProps(userProps) {\n return buildProps(referenceFns, referenceStatic, userProps);\n },\n getFloatingProps(userProps) {\n return buildProps(floatingFns, floatingStatic, userProps);\n },\n getItemProps(userProps) {\n return buildProps(itemFns, {}, userProps);\n }\n };\n}\nfunction collectProps(props, fnMap, staticMap) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = Object.keys(props)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n if (typeof props[key] === \"function\") {\n var arr = fnMap.get(key);\n if (!arr) {\n arr = [];\n fnMap.set(key, arr);\n }\n arr.push(props[key]);\n } else {\n staticMap[key] = props[key];\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n}\nfunction buildProps(fnMap, staticProps, userProps) {\n var result = {\n ...staticProps\n };\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n var _loop = function() {\n var [key, fns] = _step.value;\n var hookHandler = function() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;\n try {\n for (var _iterator2 = fns[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var fn = _step2.value;\n var result2 = fn(...args);\n if (result2 !== void 0) return result2;\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n };\n result[key] = hookHandler;\n };\n for (var _iterator = fnMap[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) _loop();\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (userProps) {\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n var _loop1 = function() {\n var key = _step1.value;\n if (key === \"style\") {\n result.style = {\n ...result.style,\n ...userProps.style\n };\n } else if (typeof userProps[key] === \"function\" && result[key]) {\n var hookFn = result[key];\n var userFn = userProps[key];\n result[key] = function() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n userFn(...args);\n hookFn(...args);\n };\n } else {\n result[key] = userProps[key];\n }\n };\n for (var _iterator1 = Object.keys(userProps)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) _loop1();\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=useInteractions.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,Q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S,OAAO;KACpB,IAAI,SAAS,UAAU;KACvB,OAAO,OAAO,WAAW;MACvB,KAAK,IAAI,OAAO,UAAU,QAAQ,OAAO,IAAI,MAAM,IAAI,GAAG,OAAO,GAAG,OAAO,MAAM,QAAQ;OACvF,KAAK,QAAQ,UAAU;MACzB;MACA,OAAO,GAAG,IAAI;MACd,OAAO,GAAG,IAAI;KAChB;IACF,OAAO;KACL,OAAO,OAAO,UAAU;IAC1B;GACF;GACA,KAAK,IAAI,aAAa,OAAO,KAAK,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC,GAAG,QAAQ,EAAE,8BAA8B,SAAS,WAAW,KAAK,EAAC,CAAE,OAAO,6BAA6B,MAAM,OAAO;EACxL,SAAS,KAAK;GACZ,qBAAqB;GACrB,kBAAkB;EACpB,UAAU;GACR,IAAI;IACF,IAAI,CAAC,8BAA8B,WAAW,UAAU,MAAM;KAC5D,WAAW,OAAO;IACpB;GACF,UAAU;IACR,IAAI,oBAAoB;KACtB,MAAM;IACR;GACF;EACF;CACF;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"useInteractions.native.js","names":[],"sources":["cjs/interactions/useInteractions.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 useInteractions_exports = {};\n__export(useInteractions_exports, {\n useInteractions: () => useInteractions\n});\nmodule.exports = __toCommonJS(useInteractions_exports);\nvar import_react = require(\"react\");\nfunction useInteractions(propsList) {\n var referenceDeps = propsList.map(function(props) {\n return props === null || props === void 0 ? void 0 : props.reference;\n });\n var floatingDeps = propsList.map(function(props) {\n return props === null || props === void 0 ? void 0 : props.floating;\n });\n var itemDeps = propsList.map(function(props) {\n return props === null || props === void 0 ? void 0 : props.item;\n });\n var getReferenceProps = (0, import_react.useCallback)(function(userProps) {\n return mergeProps(referenceDeps, userProps);\n }, referenceDeps);\n var getFloatingProps = (0, import_react.useCallback)(function(userProps) {\n return mergeProps(floatingDeps, userProps);\n }, floatingDeps);\n var getItemProps = (0, import_react.useCallback)(function(userProps) {\n return mergeProps(itemDeps, userProps, true);\n }, itemDeps);\n return (0, import_react.useMemo)(function() {\n return {\n getReferenceProps,\n getFloatingProps,\n getItemProps\n };\n }, [\n getReferenceProps,\n getFloatingProps,\n getItemProps\n ]);\n}\nfunction mergeProps(list, userProps) {\n var objectsOnly = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;\n var fnMap = /* @__PURE__ */ new Map();\n var result = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var props = _step.value;\n if (!props || objectsOnly && typeof props !== \"object\") continue;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = Object.keys(props)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var key = _step1.value;\n var value = props[key];\n if (typeof value === \"function\") {\n var arr = fnMap.get(key);\n if (!arr) {\n arr = [];\n fnMap.set(key, arr);\n }\n arr.push(value);\n } else {\n result[key] = value;\n }\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;\n try {\n var _loop = function() {\n var [key2, fns] = _step2.value;\n result[key2] = function() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;\n try {\n for (var _iterator4 = fns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var fn = _step4.value;\n var out = fn(...args);\n if (out !== void 0) return out;\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n };\n };\n for (var _iterator2 = fnMap[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) _loop();\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n if (userProps) {\n var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;\n try {\n var _loop1 = function() {\n var key2 = _step3.value;\n if (key2 === \"style\") {\n result.style = {\n ...result.style,\n ...userProps.style\n };\n } else if (typeof userProps[key2] === \"function\" && result[key2]) {\n var hookFn = result[key2];\n var userFn = userProps[key2];\n result[key2] = function() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n userFn(...args);\n hookFn(...args);\n };\n } else {\n result[key2] = userProps[key2];\n }\n };\n for (var _iterator3 = Object.keys(userProps)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) _loop1();\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=useInteractions.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,gBACz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AO,GAAG,OAAO,MAAM,QAAQ;OACvF,KAAK,QAAQ,UAAU;MACzB;MACA,OAAO,GAAG,IAAI;MACd,OAAO,GAAG,IAAI;KAChB;IACF,OAAO;KACL,OAAO,QAAQ,UAAU;IAC3B;GACF;GACA,KAAK,IAAI,aAAa,OAAO,KAAK,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC,GAAG,QAAQ,EAAE,8BAA8B,SAAS,WAAW,KAAK,EAAC,CAAE,OAAO,6BAA6B,MAAM,OAAO;EACxL,SAAS,KAAK;GACZ,qBAAqB;GACrB,kBAAkB;EACpB,UAAU;GACR,IAAI;IACF,IAAI,CAAC,8BAA8B,WAAW,UAAU,MAAM;KAC5D,WAAW,OAAO;IACpB;GACF,UAAU;IACR,IAAI,oBAAoB;KACtB,MAAM;IACR;GACF;EACF;CACF;CACA,OAAO;AACT"}
|
|
@@ -372,6 +372,8 @@ function useListNavigation(context, props) {
|
|
|
372
372
|
selectedIndex,
|
|
373
373
|
virtual
|
|
374
374
|
]);
|
|
375
|
+
const floatingRef = (0, import_react.useRef)(elements.floating);
|
|
376
|
+
floatingRef.current = elements.floating;
|
|
375
377
|
const item = (0, import_react.useMemo)(() => {
|
|
376
378
|
function syncCurrentTarget(currentTarget) {
|
|
377
379
|
if (!latestOpenRef.current) return;
|
|
@@ -405,7 +407,7 @@ function useListNavigation(context, props) {
|
|
|
405
407
|
indexRef.current = -1;
|
|
406
408
|
onNavigate();
|
|
407
409
|
if (!virtual) {
|
|
408
|
-
|
|
410
|
+
floatingRef.current?.focus({ preventScroll: true });
|
|
409
411
|
}
|
|
410
412
|
}
|
|
411
413
|
};
|
|
@@ -415,8 +417,7 @@ function useListNavigation(context, props) {
|
|
|
415
417
|
focusItemOnHover,
|
|
416
418
|
listRef,
|
|
417
419
|
onNavigate,
|
|
418
|
-
virtual
|
|
419
|
-
elements.floating
|
|
420
|
+
virtual
|
|
420
421
|
]);
|
|
421
422
|
return (0, import_react.useMemo)(() => enabled ? {
|
|
422
423
|
reference,
|
|
@@ -377,6 +377,8 @@ function useListNavigation(context, props) {
|
|
|
377
377
|
selectedIndex,
|
|
378
378
|
virtual
|
|
379
379
|
]);
|
|
380
|
+
var floatingRef = (0, import_react.useRef)(elements.floating);
|
|
381
|
+
floatingRef.current = elements.floating;
|
|
380
382
|
var item = (0, import_react.useMemo)(function() {
|
|
381
383
|
function syncCurrentTarget(currentTarget) {
|
|
382
384
|
if (!latestOpenRef.current) return;
|
|
@@ -416,8 +418,8 @@ function useListNavigation(context, props) {
|
|
|
416
418
|
indexRef.current = -1;
|
|
417
419
|
onNavigate();
|
|
418
420
|
if (!virtual) {
|
|
419
|
-
var
|
|
420
|
-
(
|
|
421
|
+
var _floatingRef_current;
|
|
422
|
+
(_floatingRef_current = floatingRef.current) === null || _floatingRef_current === void 0 ? void 0 : _floatingRef_current.focus({ preventScroll: true });
|
|
421
423
|
}
|
|
422
424
|
}
|
|
423
425
|
};
|
|
@@ -427,8 +429,7 @@ function useListNavigation(context, props) {
|
|
|
427
429
|
focusItemOnHover,
|
|
428
430
|
listRef,
|
|
429
431
|
onNavigate,
|
|
430
|
-
virtual
|
|
431
|
-
elements.floating
|
|
432
|
+
virtual
|
|
432
433
|
]);
|
|
433
434
|
return (0, import_react.useMemo)(function() {
|
|
434
435
|
return enabled ? {
|
|
@@ -377,6 +377,8 @@ function useListNavigation(context, props) {
|
|
|
377
377
|
selectedIndex,
|
|
378
378
|
virtual
|
|
379
379
|
]);
|
|
380
|
+
var floatingRef = (0, import_react.useRef)(elements.floating);
|
|
381
|
+
floatingRef.current = elements.floating;
|
|
380
382
|
var item = (0, import_react.useMemo)(function() {
|
|
381
383
|
function syncCurrentTarget(currentTarget) {
|
|
382
384
|
if (!latestOpenRef.current) return;
|
|
@@ -416,8 +418,8 @@ function useListNavigation(context, props) {
|
|
|
416
418
|
indexRef.current = -1;
|
|
417
419
|
onNavigate();
|
|
418
420
|
if (!virtual) {
|
|
419
|
-
var
|
|
420
|
-
(
|
|
421
|
+
var _floatingRef_current;
|
|
422
|
+
(_floatingRef_current = floatingRef.current) === null || _floatingRef_current === void 0 ? void 0 : _floatingRef_current.focus({ preventScroll: true });
|
|
421
423
|
}
|
|
422
424
|
}
|
|
423
425
|
};
|
|
@@ -427,8 +429,7 @@ function useListNavigation(context, props) {
|
|
|
427
429
|
focusItemOnHover,
|
|
428
430
|
listRef,
|
|
429
431
|
onNavigate,
|
|
430
|
-
virtual
|
|
431
|
-
elements.floating
|
|
432
|
+
virtual
|
|
432
433
|
]);
|
|
433
434
|
return (0, import_react.useMemo)(function() {
|
|
434
435
|
return enabled ? {
|
|
@@ -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 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 _elements_floating;\n (_elements_floating = elements.floating) === null || _elements_floating === void 0 ? void 0 : _elements_floating.focus({\n preventScroll: true\n });\n }\n }\n };\n return itemProps;\n }, [\n latestOpenRef,\n focusItemOnHover,\n listRef,\n onNavigate,\n virtual,\n elements.floating\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,GAAG,GAAG;AACzF,IAAI,4BAA4B,CAAC;AACjC,SAAS,2BAA2B,EAClC,yBAAyB,kBAC3B,CAAC;AACD,OAAO,UAAU,aAAa,yBAAyB;AACvD,IAAI,eAAe,QAAQ,OAAO;AAClC,IAAI,mBAAmB,QAAQ,oBAAoB;AACnD,IAAI,eAAe,QAAQ,mBAAS;AACpC,IAAI,WAAW;AACf,IAAI,aAAa;AACjB,IAAI,aAAa;AACjB,IAAI,cAAc;AAClB,SAAS,SAAS,aAAa,UAAU,YAAY;CACnD,QAAQ,aAAR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b;EACF;EACA,IAAI,YAAY;GACd,QAAQ,OAAO;IACb,IAAI,EAAE,kBAAkB;IACxB,kBAAkB,UAAU;IAC5B,kBAAkB,aAAa;GACjC;GACA,SAAS,SAAS,OAAO;IACvB,IAAI,EAAE,kBAAkB;IACxB,OAAO,cAAc,MAAM,EACzB,eAAe,KACjB,CAAC;GACH;GAEA,YAAY,OAAO;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,qBAAqB,SAAS,cAAc,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,MAAM,EACrH,eAAe,KACjB,CAAC;IACH;GACF;EACF;EACA,OAAO;CACT,GAAG;EACD;EACA;EACA;EACA;EACA;EACA,SAAS;CACX,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() {\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,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,GA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Z,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"}
|
|
@@ -46,13 +46,6 @@ __export(utils_exports, {
|
|
|
46
46
|
stopEvent: () => stopEvent
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(utils_exports);
|
|
49
|
-
function _instanceof(left, right) {
|
|
50
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
51
|
-
return !!right[Symbol.hasInstance](left);
|
|
52
|
-
} else {
|
|
53
|
-
return left instanceof right;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
49
|
function getDocument(node) {
|
|
57
50
|
return (node === null || node === void 0 ? void 0 : node.ownerDocument) || document;
|
|
58
51
|
}
|
|
@@ -71,7 +64,7 @@ function contains(parent, child) {
|
|
|
71
64
|
return false;
|
|
72
65
|
}
|
|
73
66
|
function isShadowRoot(node) {
|
|
74
|
-
return
|
|
67
|
+
return node instanceof ShadowRoot;
|
|
75
68
|
}
|
|
76
69
|
function getTarget(event) {
|
|
77
70
|
if ("composedPath" in event) {
|
|
@@ -88,10 +81,10 @@ function activeElement(doc) {
|
|
|
88
81
|
return el;
|
|
89
82
|
}
|
|
90
83
|
function isHTMLElement(value) {
|
|
91
|
-
return
|
|
84
|
+
return value instanceof HTMLElement;
|
|
92
85
|
}
|
|
93
86
|
function isElement(value) {
|
|
94
|
-
return
|
|
87
|
+
return value instanceof Element;
|
|
95
88
|
}
|
|
96
89
|
var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
97
90
|
function isTypeableElement(element) {
|
|
@@ -46,13 +46,6 @@ __export(utils_exports, {
|
|
|
46
46
|
stopEvent: () => stopEvent
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(utils_exports);
|
|
49
|
-
function _instanceof(left, right) {
|
|
50
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
51
|
-
return !!right[Symbol.hasInstance](left);
|
|
52
|
-
} else {
|
|
53
|
-
return left instanceof right;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
49
|
function getDocument(node) {
|
|
57
50
|
return (node === null || node === void 0 ? void 0 : node.ownerDocument) || document;
|
|
58
51
|
}
|
|
@@ -71,7 +64,7 @@ function contains(parent, child) {
|
|
|
71
64
|
return false;
|
|
72
65
|
}
|
|
73
66
|
function isShadowRoot(node) {
|
|
74
|
-
return
|
|
67
|
+
return node instanceof ShadowRoot;
|
|
75
68
|
}
|
|
76
69
|
function getTarget(event) {
|
|
77
70
|
if ("composedPath" in event) {
|
|
@@ -88,10 +81,10 @@ function activeElement(doc) {
|
|
|
88
81
|
return el;
|
|
89
82
|
}
|
|
90
83
|
function isHTMLElement(value) {
|
|
91
|
-
return
|
|
84
|
+
return value instanceof HTMLElement;
|
|
92
85
|
}
|
|
93
86
|
function isElement(value) {
|
|
94
|
-
return
|
|
87
|
+
return value instanceof Element;
|
|
95
88
|
}
|
|
96
89
|
var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
97
90
|
function isTypeableElement(element) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.native.js","names":[],"sources":["cjs/interactions/utils.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 utils_exports = {};\n__export(utils_exports, {\n activeElement: () => activeElement,\n clearTimeoutIfSet: () => clearTimeoutIfSet,\n contains: () => contains,\n enqueueFocus: () => enqueueFocus,\n findNonDisabledListIndex: () => findNonDisabledListIndex,\n getDocument: () => getDocument,\n getMaxListIndex: () => getMaxListIndex,\n getMinListIndex: () => getMinListIndex,\n getTarget: () => getTarget,\n isElement: () => isElement,\n isHTMLElement: () => isHTMLElement,\n isIndexOutOfListBounds: () => isIndexOutOfListBounds,\n isListIndexDisabled: () => isListIndexDisabled,\n isMac: () => isMac,\n isMouseLikePointerType: () => isMouseLikePointerType,\n isSafari: () => isSafari,\n isTypeableCombobox: () => isTypeableCombobox,\n isTypeableElement: () => isTypeableElement,\n isVirtualClick: () => isVirtualClick,\n isVirtualPointerEvent: () => isVirtualPointerEvent,\n matchesFocusVisible: () => matchesFocusVisible,\n stopEvent: () => stopEvent\n});\nmodule.exports = __toCommonJS(utils_exports);\nfunction _instanceof(left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return !!right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n}\nfunction getDocument(node) {\n return (node === null || node === void 0 ? void 0 : node.ownerDocument) || document;\n}\nfunction contains(parent, child) {\n var _child_getRootNode;\n if (!parent || !child) return false;\n var rootNode = (_child_getRootNode = child.getRootNode) === null || _child_getRootNode === void 0 ? void 0 : _child_getRootNode.call(child);\n if (parent.contains(child)) return true;\n if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n while (next) {\n if (parent === next) return true;\n next = next.parentNode || next.host;\n }\n }\n return false;\n}\nfunction isShadowRoot(node) {\n return _instanceof(node, ShadowRoot);\n}\nfunction getTarget(event) {\n if (\"composedPath\" in event) {\n return event.composedPath()[0];\n }\n return event.target;\n}\nfunction activeElement(doc) {\n var _el_shadowRoot;\n var el = doc.activeElement;\n while ((el === null || el === void 0 ? void 0 : (_el_shadowRoot = el.shadowRoot) === null || _el_shadowRoot === void 0 ? void 0 : _el_shadowRoot.activeElement) != null) {\n el = el.shadowRoot.activeElement;\n }\n return el;\n}\nfunction isHTMLElement(value) {\n return _instanceof(value, HTMLElement);\n}\nfunction isElement(value) {\n return _instanceof(value, Element);\n}\nvar TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nfunction isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nfunction isTypeableCombobox(element) {\n if (!element) return false;\n return element.getAttribute(\"role\") === \"combobox\" && isTypeableElement(element);\n}\nfunction getPlatform() {\n var uaData = navigator.userAgentData;\n if (uaData === null || uaData === void 0 ? void 0 : uaData.platform) return uaData.platform;\n return navigator.platform;\n}\nfunction getUserAgent() {\n var uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function(param) {\n var { brand, version } = param;\n return `${brand}/${version}`;\n }).join(\" \");\n }\n return navigator.userAgent;\n}\nfunction isSafari() {\n return /apple/i.test(navigator.vendor);\n}\nfunction isMac() {\n return getPlatform().toLowerCase().startsWith(\"mac\") && !navigator.maxTouchPoints;\n}\nfunction isJSDOM() {\n return getUserAgent().includes(\"jsdom/\");\n}\nfunction matchesFocusVisible(element) {\n if (!element || isJSDOM()) return true;\n try {\n return element.matches(\":focus-visible\");\n } catch (e) {\n return true;\n }\n}\nfunction isMouseLikePointerType(pointerType, strict) {\n var values = [\n \"mouse\",\n \"pen\"\n ];\n if (!strict) {\n values.push(\"\", void 0);\n }\n return values.includes(pointerType);\n}\nfunction clearTimeoutIfSet(timeoutRef) {\n if (timeoutRef.current !== -1) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = -1;\n }\n}\nfunction stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nfunction isVirtualClick(event) {\n if (event.mozInputSource === 0 && event.isTrusted) return true;\n if (isAndroid() && event.pointerType) {\n return event.type === \"click\" && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nfunction isVirtualPointerEvent(event) {\n if (isJSDOM()) return false;\n return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === \"mouse\" || event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === \"touch\";\n}\nfunction isAndroid() {\n var re = /android/i;\n return re.test(getPlatform()) || re.test(getUserAgent());\n}\nvar rafId = 0;\nfunction enqueueFocus(el) {\n var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var { preventScroll = false, cancelPrevious = true, sync = false } = options;\n cancelPrevious && cancelAnimationFrame(rafId);\n var exec = function() {\n return el === null || el === void 0 ? void 0 : el.focus({\n preventScroll\n });\n };\n if (sync) {\n exec();\n } else {\n rafId = requestAnimationFrame(exec);\n }\n}\nfunction isListIndexDisabled(listRef, index, disabledIndices) {\n if (typeof disabledIndices === \"function\") return disabledIndices(index);\n if (disabledIndices) return disabledIndices.includes(index);\n var element = listRef.current[index];\n return element == null || element.hasAttribute(\"disabled\") || element.getAttribute(\"aria-disabled\") === \"true\";\n}\nfunction findNonDisabledListIndex(listRef) {\n var { startingIndex = -1, decrement = false, disabledIndices, amount = 1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= listRef.current.length - 1 && isListIndexDisabled(listRef, index, disabledIndices));\n return index;\n}\nfunction getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef, {\n disabledIndices\n });\n}\nfunction getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\nfunction isIndexOutOfListBounds(listRef, index) {\n return index < 0 || index >= listRef.current.length;\n}\n//# sourceMappingURL=utils.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,gBAAgB,CAAC;AACrB,SAAS,eAAe;CACtB,qBAAqB;CACrB,yBAAyB;CACzB,gBAAgB;CAChB,oBAAoB;CACpB,gCAAgC;CAChC,mBAAmB;CACnB,uBAAuB;CACvB,uBAAuB;CACvB,iBAAiB;CACjB,iBAAiB;CACjB,qBAAqB;CACrB,8BAA8B;CAC9B,2BAA2B;CAC3B,aAAa;CACb,8BAA8B;CAC9B,gBAAgB;CAChB,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AO;EACL,QAAQ,sBAAsB,IAAI;CACpC;AACF;AACA,SAAS,oBAAoB,SAAS,OAAO,iBAAiB;CAC5D,IAAI,OAAO,oBAAoB,YAAY,OAAO,gBAAgB,KAAK;CACvE,IAAI,iBAAiB,OAAO,gBAAgB,SAAS,KAAK;CAC1D,IAAI,UAAU,QAAQ,QAAQ;CAC9B,OAAO,WAAW,QAAQ,QAAQ,aAAa,UAAU,KAAK,QAAQ,aAAa,eAAe,MAAM;AAC1G;AACA,SAAS,yBAAyB,SAAS;CACzC,IAAI,EAAE,gBAAgB,CAAC,GAAG,YAAY,OAAO,iBAAiB,SAAS,MAAM,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAC/I,IAAI,QAAQ;CACZ,GAAG;EACD,SAAS,YAAY,CAAC,SAAS;CACjC,SAAS,SAAS,KAAK,SAAS,QAAQ,QAAQ,SAAS,KAAK,oBAAoB,SAAS,OAAO,eAAe;CACjH,OAAO;AACT;AACA,SAAS,gBAAgB,SAAS,iBAAiB;CACjD,OAAO,yBAAyB,SAAS,EACvC,gBACF,CAAC;AACH;AACA,SAAS,gBAAgB,SAAS,iBAAiB;CACjD,OAAO,yBAAyB,SAAS;EACvC,WAAW;EACX,eAAe,QAAQ,QAAQ;EAC/B;CACF,CAAC;AACH;AACA,SAAS,uBAAuB,SAAS,OAAO;CAC9C,OAAO,QAAQ,KAAK,SAAS,QAAQ,QAAQ;AAC/C"}
|
|
1
|
+
{"version":3,"file":"utils.native.js","names":[],"sources":["cjs/interactions/utils.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 utils_exports = {};\n__export(utils_exports, {\n activeElement: () => activeElement,\n clearTimeoutIfSet: () => clearTimeoutIfSet,\n contains: () => contains,\n enqueueFocus: () => enqueueFocus,\n findNonDisabledListIndex: () => findNonDisabledListIndex,\n getDocument: () => getDocument,\n getMaxListIndex: () => getMaxListIndex,\n getMinListIndex: () => getMinListIndex,\n getTarget: () => getTarget,\n isElement: () => isElement,\n isHTMLElement: () => isHTMLElement,\n isIndexOutOfListBounds: () => isIndexOutOfListBounds,\n isListIndexDisabled: () => isListIndexDisabled,\n isMac: () => isMac,\n isMouseLikePointerType: () => isMouseLikePointerType,\n isSafari: () => isSafari,\n isTypeableCombobox: () => isTypeableCombobox,\n isTypeableElement: () => isTypeableElement,\n isVirtualClick: () => isVirtualClick,\n isVirtualPointerEvent: () => isVirtualPointerEvent,\n matchesFocusVisible: () => matchesFocusVisible,\n stopEvent: () => stopEvent\n});\nmodule.exports = __toCommonJS(utils_exports);\nfunction getDocument(node) {\n return (node === null || node === void 0 ? void 0 : node.ownerDocument) || document;\n}\nfunction contains(parent, child) {\n var _child_getRootNode;\n if (!parent || !child) return false;\n var rootNode = (_child_getRootNode = child.getRootNode) === null || _child_getRootNode === void 0 ? void 0 : _child_getRootNode.call(child);\n if (parent.contains(child)) return true;\n if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n while (next) {\n if (parent === next) return true;\n next = next.parentNode || next.host;\n }\n }\n return false;\n}\nfunction isShadowRoot(node) {\n return node instanceof ShadowRoot;\n}\nfunction getTarget(event) {\n if (\"composedPath\" in event) {\n return event.composedPath()[0];\n }\n return event.target;\n}\nfunction activeElement(doc) {\n var _el_shadowRoot;\n var el = doc.activeElement;\n while ((el === null || el === void 0 ? void 0 : (_el_shadowRoot = el.shadowRoot) === null || _el_shadowRoot === void 0 ? void 0 : _el_shadowRoot.activeElement) != null) {\n el = el.shadowRoot.activeElement;\n }\n return el;\n}\nfunction isHTMLElement(value) {\n return value instanceof HTMLElement;\n}\nfunction isElement(value) {\n return value instanceof Element;\n}\nvar TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nfunction isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nfunction isTypeableCombobox(element) {\n if (!element) return false;\n return element.getAttribute(\"role\") === \"combobox\" && isTypeableElement(element);\n}\nfunction getPlatform() {\n var uaData = navigator.userAgentData;\n if (uaData === null || uaData === void 0 ? void 0 : uaData.platform) return uaData.platform;\n return navigator.platform;\n}\nfunction getUserAgent() {\n var uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function(param) {\n var { brand, version } = param;\n return `${brand}/${version}`;\n }).join(\" \");\n }\n return navigator.userAgent;\n}\nfunction isSafari() {\n return /apple/i.test(navigator.vendor);\n}\nfunction isMac() {\n return getPlatform().toLowerCase().startsWith(\"mac\") && !navigator.maxTouchPoints;\n}\nfunction isJSDOM() {\n return getUserAgent().includes(\"jsdom/\");\n}\nfunction matchesFocusVisible(element) {\n if (!element || isJSDOM()) return true;\n try {\n return element.matches(\":focus-visible\");\n } catch (e) {\n return true;\n }\n}\nfunction isMouseLikePointerType(pointerType, strict) {\n var values = [\n \"mouse\",\n \"pen\"\n ];\n if (!strict) {\n values.push(\"\", void 0);\n }\n return values.includes(pointerType);\n}\nfunction clearTimeoutIfSet(timeoutRef) {\n if (timeoutRef.current !== -1) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = -1;\n }\n}\nfunction stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nfunction isVirtualClick(event) {\n if (event.mozInputSource === 0 && event.isTrusted) return true;\n if (isAndroid() && event.pointerType) {\n return event.type === \"click\" && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nfunction isVirtualPointerEvent(event) {\n if (isJSDOM()) return false;\n return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === \"mouse\" || event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === \"touch\";\n}\nfunction isAndroid() {\n var re = /android/i;\n return re.test(getPlatform()) || re.test(getUserAgent());\n}\nvar rafId = 0;\nfunction enqueueFocus(el) {\n var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var { preventScroll = false, cancelPrevious = true, sync = false } = options;\n cancelPrevious && cancelAnimationFrame(rafId);\n var exec = function() {\n return el === null || el === void 0 ? void 0 : el.focus({\n preventScroll\n });\n };\n if (sync) {\n exec();\n } else {\n rafId = requestAnimationFrame(exec);\n }\n}\nfunction isListIndexDisabled(listRef, index, disabledIndices) {\n if (typeof disabledIndices === \"function\") return disabledIndices(index);\n if (disabledIndices) return disabledIndices.includes(index);\n var element = listRef.current[index];\n return element == null || element.hasAttribute(\"disabled\") || element.getAttribute(\"aria-disabled\") === \"true\";\n}\nfunction findNonDisabledListIndex(listRef) {\n var { startingIndex = -1, decrement = false, disabledIndices, amount = 1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= listRef.current.length - 1 && isListIndexDisabled(listRef, index, disabledIndices));\n return index;\n}\nfunction getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef, {\n disabledIndices\n });\n}\nfunction getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\nfunction isIndexOutOfListBounds(listRef, index) {\n return index < 0 || index >= listRef.current.length;\n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QAAQ;CACZ,GAAG;EACD,SAAS,YAAY,CAAC,SAAS;CACjC,SAAS,SAAS,KAAK,SAAS,QAAQ,QAAQ,SAAS,KAAK,oBAAoB,SAAS,OAAO,eAAe;CACjH,OAAO;AACT;AACA,SAAS,gBAAgB,SAAS,iBAAiB;CACjD,OAAO,yBAAyB,SAAS,EACvC,gBACF,CAAC;AACH;AACA,SAAS,gBAAgB,SAAS,iBAAiB;CACjD,OAAO,yBAAyB,SAAS;EACvC,WAAW;EACX,eAAe,QAAQ,QAAQ;EAC/B;CACF,CAAC;AACH;AACA,SAAS,uBAAuB,SAAS,OAAO;CAC9C,OAAO,QAAQ,KAAK,SAAS,QAAQ,QAAQ;AAC/C"}
|
|
@@ -1,57 +1,48 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
|
|
1
3
|
function useInteractions(propsList) {
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
getReferenceProps(userProps) {
|
|
21
|
-
return buildProps(referenceFns, referenceStatic, userProps);
|
|
22
|
-
},
|
|
23
|
-
getFloatingProps(userProps) {
|
|
24
|
-
return buildProps(floatingFns, floatingStatic, userProps);
|
|
25
|
-
},
|
|
26
|
-
getItemProps(userProps) {
|
|
27
|
-
return buildProps(itemFns, {}, userProps);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
4
|
+
const referenceDeps = propsList.map((props) => props?.reference);
|
|
5
|
+
const floatingDeps = propsList.map((props) => props?.floating);
|
|
6
|
+
const itemDeps = propsList.map((props) => props?.item);
|
|
7
|
+
const getReferenceProps = useCallback((userProps) => mergeProps(referenceDeps, userProps), referenceDeps);
|
|
8
|
+
const getFloatingProps = useCallback((userProps) => mergeProps(floatingDeps, userProps), floatingDeps);
|
|
9
|
+
const getItemProps = useCallback((userProps) => mergeProps(itemDeps, userProps, true), itemDeps);
|
|
10
|
+
return useMemo(() => ({
|
|
11
|
+
getReferenceProps,
|
|
12
|
+
getFloatingProps,
|
|
13
|
+
getItemProps
|
|
14
|
+
}), [
|
|
15
|
+
getReferenceProps,
|
|
16
|
+
getFloatingProps,
|
|
17
|
+
getItemProps
|
|
18
|
+
]);
|
|
30
19
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
function mergeProps(list, userProps, objectsOnly = false) {
|
|
21
|
+
const fnMap = /* @__PURE__ */ new Map();
|
|
22
|
+
const result = {};
|
|
23
|
+
for (const props of list) {
|
|
24
|
+
if (!props || objectsOnly && typeof props !== "object") continue;
|
|
25
|
+
for (const key of Object.keys(props)) {
|
|
26
|
+
const value = props[key];
|
|
27
|
+
if (typeof value === "function") {
|
|
28
|
+
let arr = fnMap.get(key);
|
|
29
|
+
if (!arr) {
|
|
30
|
+
arr = [];
|
|
31
|
+
fnMap.set(key, arr);
|
|
32
|
+
}
|
|
33
|
+
arr.push(value);
|
|
34
|
+
} else {
|
|
35
|
+
result[key] = value;
|
|
38
36
|
}
|
|
39
|
-
arr.push(props[key]);
|
|
40
|
-
} else {
|
|
41
|
-
staticMap[key] = props[key];
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
|
-
}
|
|
45
|
-
function buildProps(fnMap, staticProps, userProps) {
|
|
46
|
-
const result = { ...staticProps };
|
|
47
39
|
for (const [key, fns] of fnMap) {
|
|
48
|
-
|
|
40
|
+
result[key] = (...args) => {
|
|
49
41
|
for (const fn of fns) {
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
42
|
+
const out = fn(...args);
|
|
43
|
+
if (out !== void 0) return out;
|
|
52
44
|
}
|
|
53
45
|
};
|
|
54
|
-
result[key] = hookHandler;
|
|
55
46
|
}
|
|
56
47
|
if (userProps) {
|
|
57
48
|
for (const key of Object.keys(userProps)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInteractions.js","names":[],"sources":["esm/interactions/useInteractions.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useInteractions.js","names":[],"sources":["esm/interactions/useInteractions.js"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nfunction useInteractions(propsList) {\n const referenceDeps = propsList.map((props) => props?.reference);\n const floatingDeps = propsList.map((props) => props?.floating);\n const itemDeps = propsList.map((props) => props?.item);\n const getReferenceProps = useCallback(\n (userProps) => mergeProps(referenceDeps, userProps),\n referenceDeps\n );\n const getFloatingProps = useCallback(\n (userProps) => mergeProps(floatingDeps, userProps),\n floatingDeps\n );\n const getItemProps = useCallback(\n (userProps) => mergeProps(itemDeps, userProps, true),\n itemDeps\n );\n return useMemo(\n () => ({\n getReferenceProps,\n getFloatingProps,\n getItemProps\n }),\n [getReferenceProps, getFloatingProps, getItemProps]\n );\n}\nfunction mergeProps(list, userProps, objectsOnly = false) {\n const fnMap = /* @__PURE__ */ new Map();\n const result = {};\n for (const props of list) {\n if (!props || objectsOnly && typeof props !== \"object\") continue;\n for (const key of Object.keys(props)) {\n const value = props[key];\n if (typeof value === \"function\") {\n let arr = fnMap.get(key);\n if (!arr) {\n arr = [];\n fnMap.set(key, arr);\n }\n arr.push(value);\n } else {\n result[key] = value;\n }\n }\n }\n for (const [key, fns] of fnMap) {\n result[key] = (...args) => {\n for (const fn of fns) {\n const out = fn(...args);\n if (out !== void 0) return out;\n }\n };\n }\n if (userProps) {\n for (const key of Object.keys(userProps)) {\n if (key === \"style\") {\n result.style = { ...result.style, ...userProps.style };\n } else if (typeof userProps[key] === \"function\" && result[key]) {\n const hookFn = result[key];\n const userFn = userProps[key];\n result[key] = (...args) => {\n userFn(...args);\n hookFn(...args);\n };\n } else {\n result[key] = userProps[key];\n }\n }\n }\n return result;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