@tamagui/floating 2.7.7 → 3.0.0-beta.643.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/cjs/Floating.cjs +10 -11
  2. package/dist/cjs/Floating.native.cjs +37 -0
  3. package/dist/cjs/Floating.native.js +20 -20
  4. package/dist/cjs/Floating.native.js.map +1 -1
  5. package/dist/cjs/index.cjs +45 -46
  6. package/dist/cjs/index.native.cjs +74 -0
  7. package/dist/cjs/index.native.js +45 -45
  8. package/dist/cjs/index.native.js.map +1 -1
  9. package/dist/cjs/interactions/PopupTriggerMap.cjs +36 -39
  10. package/dist/cjs/interactions/PopupTriggerMap.native.cjs +96 -0
  11. package/dist/cjs/interactions/PopupTriggerMap.native.js +76 -75
  12. package/dist/cjs/interactions/PopupTriggerMap.native.js.map +1 -1
  13. package/dist/cjs/interactions/createFloatingEvents.cjs +36 -39
  14. package/dist/cjs/interactions/createFloatingEvents.native.cjs +52 -0
  15. package/dist/cjs/interactions/createFloatingEvents.native.js +39 -41
  16. package/dist/cjs/interactions/createFloatingEvents.native.js.map +1 -1
  17. package/dist/cjs/interactions/safePolygon.cjs +263 -252
  18. package/dist/cjs/interactions/safePolygon.native.cjs +294 -0
  19. package/dist/cjs/interactions/safePolygon.native.js +271 -259
  20. package/dist/cjs/interactions/safePolygon.native.js.map +1 -1
  21. package/dist/cjs/interactions/types.cjs +10 -11
  22. package/dist/cjs/interactions/types.native.cjs +19 -0
  23. package/dist/cjs/interactions/types.native.js +10 -10
  24. package/dist/cjs/interactions/types.native.js.map +1 -1
  25. package/dist/cjs/interactions/useClick.cjs +96 -105
  26. package/dist/cjs/interactions/useClick.native.cjs +122 -0
  27. package/dist/cjs/interactions/useClick.native.js +101 -109
  28. package/dist/cjs/interactions/useClick.native.js.map +1 -1
  29. package/dist/cjs/interactions/useDelayGroup.cjs +86 -91
  30. package/dist/cjs/interactions/useDelayGroup.native.cjs +119 -0
  31. package/dist/cjs/interactions/useDelayGroup.native.js +92 -96
  32. package/dist/cjs/interactions/useDelayGroup.native.js.map +1 -1
  33. package/dist/cjs/interactions/useFocus.cjs +108 -115
  34. package/dist/cjs/interactions/useFocus.native.cjs +131 -0
  35. package/dist/cjs/interactions/useFocus.native.js +114 -120
  36. package/dist/cjs/interactions/useFocus.native.js.map +1 -1
  37. package/dist/cjs/interactions/useHover.cjs +321 -335
  38. package/dist/cjs/interactions/useHover.native.cjs +357 -0
  39. package/dist/cjs/interactions/useHover.native.js +333 -347
  40. package/dist/cjs/interactions/useHover.native.js.map +1 -1
  41. package/dist/cjs/interactions/useInnerOffset.cjs +103 -111
  42. package/dist/cjs/interactions/useInnerOffset.native.cjs +132 -0
  43. package/dist/cjs/interactions/useInnerOffset.native.js +113 -120
  44. package/dist/cjs/interactions/useInnerOffset.native.js.map +1 -1
  45. package/dist/cjs/interactions/useInteractions.cjs +85 -90
  46. package/dist/cjs/interactions/useInteractions.native.cjs +199 -0
  47. package/dist/cjs/interactions/useInteractions.native.js +180 -195
  48. package/dist/cjs/interactions/useInteractions.native.js.map +1 -1
  49. package/dist/cjs/interactions/useListNavigation.cjs +404 -390
  50. package/dist/cjs/interactions/useListNavigation.native.cjs +446 -0
  51. package/dist/cjs/interactions/useListNavigation.native.js +416 -401
  52. package/dist/cjs/interactions/useListNavigation.native.js.map +1 -1
  53. package/dist/cjs/interactions/useRole.cjs +92 -106
  54. package/dist/cjs/interactions/useRole.native.cjs +121 -0
  55. package/dist/cjs/interactions/useRole.native.js +103 -116
  56. package/dist/cjs/interactions/useRole.native.js.map +1 -1
  57. package/dist/cjs/interactions/useTypeahead.cjs +115 -129
  58. package/dist/cjs/interactions/useTypeahead.native.cjs +144 -0
  59. package/dist/cjs/interactions/useTypeahead.native.js +128 -141
  60. package/dist/cjs/interactions/useTypeahead.native.js.map +1 -1
  61. package/dist/cjs/interactions/utils.cjs +126 -143
  62. package/dist/cjs/interactions/utils.native.cjs +209 -0
  63. package/dist/cjs/interactions/utils.native.js +138 -154
  64. package/dist/cjs/interactions/utils.native.js.map +1 -1
  65. package/dist/cjs/middleware/inner.cjs +74 -101
  66. package/dist/cjs/middleware/inner.native.cjs +102 -0
  67. package/dist/cjs/middleware/inner.native.js +83 -109
  68. package/dist/cjs/middleware/inner.native.js.map +1 -1
  69. package/dist/cjs/useFloating.cjs +34 -46
  70. package/dist/cjs/useFloating.native.cjs +56 -0
  71. package/dist/cjs/useFloating.native.js +37 -48
  72. package/dist/cjs/useFloating.native.js.map +1 -1
  73. package/dist/esm/Floating.mjs +1 -2
  74. package/dist/esm/Floating.native.js +6 -4
  75. package/dist/esm/Floating.native.js.map +1 -1
  76. package/dist/esm/index.js +4 -5
  77. package/dist/esm/index.mjs +4 -5
  78. package/dist/esm/index.native.js +4 -5
  79. package/dist/esm/interactions/PopupTriggerMap.mjs +23 -22
  80. package/dist/esm/interactions/PopupTriggerMap.mjs.map +1 -1
  81. package/dist/esm/interactions/PopupTriggerMap.native.js +62 -58
  82. package/dist/esm/interactions/PopupTriggerMap.native.js.map +1 -1
  83. package/dist/esm/interactions/createFloatingEvents.mjs +22 -21
  84. package/dist/esm/interactions/createFloatingEvents.mjs.map +1 -1
  85. package/dist/esm/interactions/createFloatingEvents.native.js +25 -24
  86. package/dist/esm/interactions/createFloatingEvents.native.js.map +1 -1
  87. package/dist/esm/interactions/safePolygon.mjs +250 -234
  88. package/dist/esm/interactions/safePolygon.mjs.map +1 -1
  89. package/dist/esm/interactions/safePolygon.native.js +258 -242
  90. package/dist/esm/interactions/safePolygon.native.js.map +1 -1
  91. package/dist/esm/interactions/types.mjs +0 -2
  92. package/dist/esm/interactions/types.native.js +0 -2
  93. package/dist/esm/interactions/useClick.mjs +83 -87
  94. package/dist/esm/interactions/useClick.mjs.map +1 -1
  95. package/dist/esm/interactions/useClick.native.js +88 -92
  96. package/dist/esm/interactions/useClick.native.js.map +1 -1
  97. package/dist/esm/interactions/useDelayGroup.mjs +68 -65
  98. package/dist/esm/interactions/useDelayGroup.mjs.map +1 -1
  99. package/dist/esm/interactions/useDelayGroup.native.js +74 -71
  100. package/dist/esm/interactions/useDelayGroup.native.js.map +1 -1
  101. package/dist/esm/interactions/useFocus.mjs +95 -97
  102. package/dist/esm/interactions/useFocus.mjs.map +1 -1
  103. package/dist/esm/interactions/useFocus.native.js +101 -103
  104. package/dist/esm/interactions/useFocus.native.js.map +1 -1
  105. package/dist/esm/interactions/useHover.mjs +304 -310
  106. package/dist/esm/interactions/useHover.mjs.map +1 -1
  107. package/dist/esm/interactions/useHover.native.js +316 -323
  108. package/dist/esm/interactions/useHover.native.js.map +1 -1
  109. package/dist/esm/interactions/useInnerOffset.mjs +87 -85
  110. package/dist/esm/interactions/useInnerOffset.mjs.map +1 -1
  111. package/dist/esm/interactions/useInnerOffset.native.js +97 -95
  112. package/dist/esm/interactions/useInnerOffset.native.js.map +1 -1
  113. package/dist/esm/interactions/useInteractions.mjs +71 -72
  114. package/dist/esm/interactions/useInteractions.mjs.map +1 -1
  115. package/dist/esm/interactions/useInteractions.native.js +166 -178
  116. package/dist/esm/interactions/useInteractions.native.js.map +1 -1
  117. package/dist/esm/interactions/useListNavigation.mjs +392 -373
  118. package/dist/esm/interactions/useListNavigation.mjs.map +1 -1
  119. package/dist/esm/interactions/useListNavigation.native.js +404 -385
  120. package/dist/esm/interactions/useListNavigation.native.js.map +1 -1
  121. package/dist/esm/interactions/useRole.mjs +76 -80
  122. package/dist/esm/interactions/useRole.mjs.map +1 -1
  123. package/dist/esm/interactions/useRole.native.js +87 -91
  124. package/dist/esm/interactions/useRole.native.js.map +1 -1
  125. package/dist/esm/interactions/useTypeahead.mjs +102 -111
  126. package/dist/esm/interactions/useTypeahead.mjs.map +1 -1
  127. package/dist/esm/interactions/useTypeahead.native.js +115 -124
  128. package/dist/esm/interactions/useTypeahead.native.js.map +1 -1
  129. package/dist/esm/interactions/utils.mjs +91 -106
  130. package/dist/esm/interactions/utils.mjs.map +1 -1
  131. package/dist/esm/interactions/utils.native.js +103 -118
  132. package/dist/esm/interactions/utils.native.js.map +1 -1
  133. package/dist/esm/middleware/inner.mjs +58 -75
  134. package/dist/esm/middleware/inner.mjs.map +1 -1
  135. package/dist/esm/middleware/inner.native.js +67 -84
  136. package/dist/esm/middleware/inner.native.js.map +1 -1
  137. package/dist/esm/useFloating.mjs +17 -21
  138. package/dist/esm/useFloating.mjs.map +1 -1
  139. package/dist/esm/useFloating.native.js +19 -23
  140. package/dist/esm/useFloating.native.js.map +1 -1
  141. package/package.json +6 -5
  142. package/types/interactions/PopupTriggerMap.d.ts.map +1 -1
  143. package/types/interactions/useInteractions.d.ts.map +1 -1
  144. package/types/middleware/inner.d.ts.map +1 -1
  145. package/types/useFloating.d.ts.map +1 -1
  146. package/dist/esm/Floating.mjs.map +0 -1
  147. package/dist/esm/index.js.map +0 -1
  148. package/dist/esm/index.mjs.map +0 -1
  149. package/dist/esm/index.native.js.map +0 -1
  150. package/dist/esm/interactions/types.mjs.map +0 -1
  151. package/dist/esm/interactions/types.native.js.map +0 -1
@@ -1,208 +1,191 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
10
11
  };
11
12
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
19
20
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
22
  var utils_exports = {};
24
23
  __export(utils_exports, {
25
- activeElement: () => activeElement,
26
- clearTimeoutIfSet: () => clearTimeoutIfSet,
27
- contains: () => contains,
28
- enqueueFocus: () => enqueueFocus,
29
- findNonDisabledListIndex: () => findNonDisabledListIndex,
30
- getDocument: () => getDocument,
31
- getMaxListIndex: () => getMaxListIndex,
32
- getMinListIndex: () => getMinListIndex,
33
- getTarget: () => getTarget,
34
- isElement: () => isElement,
35
- isHTMLElement: () => isHTMLElement,
36
- isIndexOutOfListBounds: () => isIndexOutOfListBounds,
37
- isListIndexDisabled: () => isListIndexDisabled,
38
- isMac: () => isMac,
39
- isMouseLikePointerType: () => isMouseLikePointerType,
40
- isSafari: () => isSafari,
41
- isTypeableCombobox: () => isTypeableCombobox,
42
- isTypeableElement: () => isTypeableElement,
43
- isVirtualClick: () => isVirtualClick,
44
- isVirtualPointerEvent: () => isVirtualPointerEvent,
45
- matchesFocusVisible: () => matchesFocusVisible,
46
- stopEvent: () => stopEvent
24
+ activeElement: () => activeElement,
25
+ clearTimeoutIfSet: () => clearTimeoutIfSet,
26
+ contains: () => contains,
27
+ enqueueFocus: () => enqueueFocus,
28
+ findNonDisabledListIndex: () => findNonDisabledListIndex,
29
+ getDocument: () => getDocument,
30
+ getMaxListIndex: () => getMaxListIndex,
31
+ getMinListIndex: () => getMinListIndex,
32
+ getTarget: () => getTarget,
33
+ isElement: () => isElement,
34
+ isHTMLElement: () => isHTMLElement,
35
+ isIndexOutOfListBounds: () => isIndexOutOfListBounds,
36
+ isListIndexDisabled: () => isListIndexDisabled,
37
+ isMac: () => isMac,
38
+ isMouseLikePointerType: () => isMouseLikePointerType,
39
+ isSafari: () => isSafari,
40
+ isTypeableCombobox: () => isTypeableCombobox,
41
+ isTypeableElement: () => isTypeableElement,
42
+ isVirtualClick: () => isVirtualClick,
43
+ isVirtualPointerEvent: () => isVirtualPointerEvent,
44
+ matchesFocusVisible: () => matchesFocusVisible,
45
+ stopEvent: () => stopEvent
47
46
  });
48
47
  module.exports = __toCommonJS(utils_exports);
49
48
  function getDocument(node) {
50
- return node?.ownerDocument || document;
49
+ return node?.ownerDocument || document;
51
50
  }
52
51
  function contains(parent, child) {
53
- if (!parent || !child) return false;
54
- const rootNode = child.getRootNode?.();
55
- if (parent.contains(child)) return true;
56
- if (rootNode && isShadowRoot(rootNode)) {
57
- let next = child;
58
- while (next) {
59
- if (parent === next) return true;
60
- next = next.parentNode || next.host;
61
- }
62
- }
63
- return false;
52
+ if (!parent || !child) return false;
53
+ const rootNode = child.getRootNode?.();
54
+ if (parent.contains(child)) return true;
55
+ if (rootNode && isShadowRoot(rootNode)) {
56
+ let next = child;
57
+ while (next) {
58
+ if (parent === next) return true;
59
+ next = next.parentNode || next.host;
60
+ }
61
+ }
62
+ return false;
64
63
  }
65
64
  function isShadowRoot(node) {
66
- return node instanceof ShadowRoot;
65
+ return node instanceof ShadowRoot;
67
66
  }
68
67
  function getTarget(event) {
69
- if ("composedPath" in event) {
70
- return event.composedPath()[0];
71
- }
72
- return event.target;
68
+ if ("composedPath" in event) {
69
+ return event.composedPath()[0];
70
+ }
71
+ return event.target;
73
72
  }
74
73
  function activeElement(doc) {
75
- let el = doc.activeElement;
76
- while (el?.shadowRoot?.activeElement != null) {
77
- el = el.shadowRoot.activeElement;
78
- }
79
- return el;
74
+ let el = doc.activeElement;
75
+ while (el?.shadowRoot?.activeElement != null) {
76
+ el = el.shadowRoot.activeElement;
77
+ }
78
+ return el;
80
79
  }
81
80
  function isHTMLElement(value) {
82
- return value instanceof HTMLElement;
81
+ return value instanceof HTMLElement;
83
82
  }
84
83
  function isElement(value) {
85
- return value instanceof Element;
84
+ return value instanceof Element;
86
85
  }
87
86
  const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
88
87
  function isTypeableElement(element) {
89
- return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
88
+ return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
90
89
  }
91
90
  function isTypeableCombobox(element) {
92
- if (!element) return false;
93
- return element.getAttribute("role") === "combobox" && isTypeableElement(element);
91
+ if (!element) return false;
92
+ return element.getAttribute("role") === "combobox" && isTypeableElement(element);
94
93
  }
95
94
  function getPlatform() {
96
- const uaData = navigator.userAgentData;
97
- if (uaData?.platform) return uaData.platform;
98
- return navigator.platform;
95
+ const uaData = navigator.userAgentData;
96
+ if (uaData?.platform) return uaData.platform;
97
+ return navigator.platform;
99
98
  }
100
99
  function getUserAgent() {
101
- const uaData = navigator.userAgentData;
102
- if (uaData && Array.isArray(uaData.brands)) {
103
- return uaData.brands.map(({
104
- brand,
105
- version
106
- }) => `${brand}/${version}`).join(" ");
107
- }
108
- return navigator.userAgent;
100
+ const uaData = navigator.userAgentData;
101
+ if (uaData && Array.isArray(uaData.brands)) {
102
+ return uaData.brands.map(({ brand, version }) => `${brand}/${version}`).join(" ");
103
+ }
104
+ return navigator.userAgent;
109
105
  }
110
106
  function isSafari() {
111
- return /apple/i.test(navigator.vendor);
107
+ return /apple/i.test(navigator.vendor);
112
108
  }
113
109
  function isMac() {
114
- return getPlatform().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
110
+ return getPlatform().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
115
111
  }
116
112
  function isJSDOM() {
117
- return getUserAgent().includes("jsdom/");
113
+ return getUserAgent().includes("jsdom/");
118
114
  }
119
115
  function matchesFocusVisible(element) {
120
- if (!element || isJSDOM()) return true;
121
- try {
122
- return element.matches(":focus-visible");
123
- } catch {
124
- return true;
125
- }
116
+ if (!element || isJSDOM()) return true;
117
+ try {
118
+ return element.matches(":focus-visible");
119
+ } catch {
120
+ return true;
121
+ }
126
122
  }
127
123
  function isMouseLikePointerType(pointerType, strict) {
128
- const values = ["mouse", "pen"];
129
- if (!strict) {
130
- values.push("", void 0);
131
- }
132
- return values.includes(pointerType);
124
+ const values = ["mouse", "pen"];
125
+ if (!strict) {
126
+ values.push("", void 0);
127
+ }
128
+ return values.includes(pointerType);
133
129
  }
134
130
  function clearTimeoutIfSet(timeoutRef) {
135
- if (timeoutRef.current !== -1) {
136
- clearTimeout(timeoutRef.current);
137
- timeoutRef.current = -1;
138
- }
131
+ if (timeoutRef.current !== -1) {
132
+ clearTimeout(timeoutRef.current);
133
+ timeoutRef.current = -1;
134
+ }
139
135
  }
140
136
  function stopEvent(event) {
141
- event.preventDefault();
142
- event.stopPropagation();
137
+ event.preventDefault();
138
+ event.stopPropagation();
143
139
  }
144
140
  function isVirtualClick(event) {
145
- if (event.mozInputSource === 0 && event.isTrusted) return true;
146
- if (isAndroid() && event.pointerType) {
147
- return event.type === "click" && event.buttons === 1;
148
- }
149
- return event.detail === 0 && !event.pointerType;
141
+ if (event.mozInputSource === 0 && event.isTrusted) return true;
142
+ if (isAndroid() && event.pointerType) {
143
+ return event.type === "click" && event.buttons === 1;
144
+ }
145
+ return event.detail === 0 && !event.pointerType;
150
146
  }
151
147
  function isVirtualPointerEvent(event) {
152
- if (isJSDOM()) return false;
153
- 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";
148
+ if (isJSDOM()) return false;
149
+ 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";
154
150
  }
155
151
  function isAndroid() {
156
- const re = /android/i;
157
- return re.test(getPlatform()) || re.test(getUserAgent());
152
+ const re = /android/i;
153
+ return re.test(getPlatform()) || re.test(getUserAgent());
158
154
  }
159
155
  let rafId = 0;
160
156
  function enqueueFocus(el, options = {}) {
161
- const {
162
- preventScroll = false,
163
- cancelPrevious = true,
164
- sync = false
165
- } = options;
166
- cancelPrevious && cancelAnimationFrame(rafId);
167
- const exec = () => el?.focus({
168
- preventScroll
169
- });
170
- if (sync) {
171
- exec();
172
- } else {
173
- rafId = requestAnimationFrame(exec);
174
- }
157
+ const { preventScroll = false, cancelPrevious = true, sync = false } = options;
158
+ cancelPrevious && cancelAnimationFrame(rafId);
159
+ const exec = () => el?.focus({ preventScroll });
160
+ if (sync) {
161
+ exec();
162
+ } else {
163
+ rafId = requestAnimationFrame(exec);
164
+ }
175
165
  }
176
166
  function isListIndexDisabled(listRef, index, disabledIndices) {
177
- if (typeof disabledIndices === "function") return disabledIndices(index);
178
- if (disabledIndices) return disabledIndices.includes(index);
179
- const element = listRef.current[index];
180
- return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
181
- }
182
- function findNonDisabledListIndex(listRef, {
183
- startingIndex = -1,
184
- decrement = false,
185
- disabledIndices,
186
- amount = 1
187
- } = {}) {
188
- let index = startingIndex;
189
- do {
190
- index += decrement ? -amount : amount;
191
- } while (index >= 0 && index <= listRef.current.length - 1 && isListIndexDisabled(listRef, index, disabledIndices));
192
- return index;
167
+ if (typeof disabledIndices === "function") return disabledIndices(index);
168
+ if (disabledIndices) return disabledIndices.includes(index);
169
+ const element = listRef.current[index];
170
+ return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
171
+ }
172
+ function findNonDisabledListIndex(listRef, { startingIndex = -1, decrement = false, disabledIndices, amount = 1 } = {}) {
173
+ let index = startingIndex;
174
+ do {
175
+ index += decrement ? -amount : amount;
176
+ } while (index >= 0 && index <= listRef.current.length - 1 && isListIndexDisabled(listRef, index, disabledIndices));
177
+ return index;
193
178
  }
194
179
  function getMinListIndex(listRef, disabledIndices) {
195
- return findNonDisabledListIndex(listRef, {
196
- disabledIndices
197
- });
180
+ return findNonDisabledListIndex(listRef, { disabledIndices });
198
181
  }
199
182
  function getMaxListIndex(listRef, disabledIndices) {
200
- return findNonDisabledListIndex(listRef, {
201
- decrement: true,
202
- startingIndex: listRef.current.length,
203
- disabledIndices
204
- });
183
+ return findNonDisabledListIndex(listRef, {
184
+ decrement: true,
185
+ startingIndex: listRef.current.length,
186
+ disabledIndices
187
+ });
205
188
  }
206
189
  function isIndexOutOfListBounds(listRef, index) {
207
- return index < 0 || index >= listRef.current.length;
208
- }
190
+ return index < 0 || index >= listRef.current.length;
191
+ }
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var utils_exports = {};
25
+ __export(utils_exports, {
26
+ activeElement: () => activeElement,
27
+ clearTimeoutIfSet: () => clearTimeoutIfSet,
28
+ contains: () => contains,
29
+ enqueueFocus: () => enqueueFocus,
30
+ findNonDisabledListIndex: () => findNonDisabledListIndex,
31
+ getDocument: () => getDocument,
32
+ getMaxListIndex: () => getMaxListIndex,
33
+ getMinListIndex: () => getMinListIndex,
34
+ getTarget: () => getTarget,
35
+ isElement: () => isElement,
36
+ isHTMLElement: () => isHTMLElement,
37
+ isIndexOutOfListBounds: () => isIndexOutOfListBounds,
38
+ isListIndexDisabled: () => isListIndexDisabled,
39
+ isMac: () => isMac,
40
+ isMouseLikePointerType: () => isMouseLikePointerType,
41
+ isSafari: () => isSafari,
42
+ isTypeableCombobox: () => isTypeableCombobox,
43
+ isTypeableElement: () => isTypeableElement,
44
+ isVirtualClick: () => isVirtualClick,
45
+ isVirtualPointerEvent: () => isVirtualPointerEvent,
46
+ matchesFocusVisible: () => matchesFocusVisible,
47
+ stopEvent: () => stopEvent
48
+ });
49
+ module.exports = __toCommonJS(utils_exports);
50
+ function _instanceof(left, right) {
51
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
52
+ return !!right[Symbol.hasInstance](left);
53
+ } else {
54
+ return left instanceof right;
55
+ }
56
+ }
57
+ function getDocument(node) {
58
+ return (node === null || node === void 0 ? void 0 : node.ownerDocument) || document;
59
+ }
60
+ function contains(parent, child) {
61
+ var _child_getRootNode;
62
+ if (!parent || !child) return false;
63
+ var rootNode = (_child_getRootNode = child.getRootNode) === null || _child_getRootNode === void 0 ? void 0 : _child_getRootNode.call(child);
64
+ if (parent.contains(child)) return true;
65
+ if (rootNode && isShadowRoot(rootNode)) {
66
+ var next = child;
67
+ while (next) {
68
+ if (parent === next) return true;
69
+ next = next.parentNode || next.host;
70
+ }
71
+ }
72
+ return false;
73
+ }
74
+ function isShadowRoot(node) {
75
+ return _instanceof(node, ShadowRoot);
76
+ }
77
+ function getTarget(event) {
78
+ if ("composedPath" in event) {
79
+ return event.composedPath()[0];
80
+ }
81
+ return event.target;
82
+ }
83
+ function activeElement(doc) {
84
+ var _el_shadowRoot;
85
+ var el = doc.activeElement;
86
+ while ((el === null || el === void 0 ? void 0 : (_el_shadowRoot = el.shadowRoot) === null || _el_shadowRoot === void 0 ? void 0 : _el_shadowRoot.activeElement) != null) {
87
+ el = el.shadowRoot.activeElement;
88
+ }
89
+ return el;
90
+ }
91
+ function isHTMLElement(value) {
92
+ return _instanceof(value, HTMLElement);
93
+ }
94
+ function isElement(value) {
95
+ return _instanceof(value, Element);
96
+ }
97
+ var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
98
+ function isTypeableElement(element) {
99
+ return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
100
+ }
101
+ function isTypeableCombobox(element) {
102
+ if (!element) return false;
103
+ return element.getAttribute("role") === "combobox" && isTypeableElement(element);
104
+ }
105
+ function getPlatform() {
106
+ var uaData = navigator.userAgentData;
107
+ if (uaData === null || uaData === void 0 ? void 0 : uaData.platform) return uaData.platform;
108
+ return navigator.platform;
109
+ }
110
+ function getUserAgent() {
111
+ var uaData = navigator.userAgentData;
112
+ if (uaData && Array.isArray(uaData.brands)) {
113
+ return uaData.brands.map(function(param) {
114
+ var { brand, version } = param;
115
+ return `${brand}/${version}`;
116
+ }).join(" ");
117
+ }
118
+ return navigator.userAgent;
119
+ }
120
+ function isSafari() {
121
+ return /apple/i.test(navigator.vendor);
122
+ }
123
+ function isMac() {
124
+ return getPlatform().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
125
+ }
126
+ function isJSDOM() {
127
+ return getUserAgent().includes("jsdom/");
128
+ }
129
+ function matchesFocusVisible(element) {
130
+ if (!element || isJSDOM()) return true;
131
+ try {
132
+ return element.matches(":focus-visible");
133
+ } catch (e) {
134
+ return true;
135
+ }
136
+ }
137
+ function isMouseLikePointerType(pointerType, strict) {
138
+ var values = ["mouse", "pen"];
139
+ if (!strict) {
140
+ values.push("", void 0);
141
+ }
142
+ return values.includes(pointerType);
143
+ }
144
+ function clearTimeoutIfSet(timeoutRef) {
145
+ if (timeoutRef.current !== -1) {
146
+ clearTimeout(timeoutRef.current);
147
+ timeoutRef.current = -1;
148
+ }
149
+ }
150
+ function stopEvent(event) {
151
+ event.preventDefault();
152
+ event.stopPropagation();
153
+ }
154
+ function isVirtualClick(event) {
155
+ if (event.mozInputSource === 0 && event.isTrusted) return true;
156
+ if (isAndroid() && event.pointerType) {
157
+ return event.type === "click" && event.buttons === 1;
158
+ }
159
+ return event.detail === 0 && !event.pointerType;
160
+ }
161
+ function isVirtualPointerEvent(event) {
162
+ if (isJSDOM()) return false;
163
+ 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";
164
+ }
165
+ function isAndroid() {
166
+ var re = /android/i;
167
+ return re.test(getPlatform()) || re.test(getUserAgent());
168
+ }
169
+ var rafId = 0;
170
+ function enqueueFocus(el) {
171
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
172
+ var { preventScroll = false, cancelPrevious = true, sync = false } = options;
173
+ cancelPrevious && cancelAnimationFrame(rafId);
174
+ var exec = function() {
175
+ return el === null || el === void 0 ? void 0 : el.focus({ preventScroll });
176
+ };
177
+ if (sync) {
178
+ exec();
179
+ } else {
180
+ rafId = requestAnimationFrame(exec);
181
+ }
182
+ }
183
+ function isListIndexDisabled(listRef, index, disabledIndices) {
184
+ if (typeof disabledIndices === "function") return disabledIndices(index);
185
+ if (disabledIndices) return disabledIndices.includes(index);
186
+ var element = listRef.current[index];
187
+ return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
188
+ }
189
+ function findNonDisabledListIndex(listRef) {
190
+ var { startingIndex = -1, decrement = false, disabledIndices, amount = 1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
191
+ var index = startingIndex;
192
+ do {
193
+ index += decrement ? -amount : amount;
194
+ } while (index >= 0 && index <= listRef.current.length - 1 && isListIndexDisabled(listRef, index, disabledIndices));
195
+ return index;
196
+ }
197
+ function getMinListIndex(listRef, disabledIndices) {
198
+ return findNonDisabledListIndex(listRef, { disabledIndices });
199
+ }
200
+ function getMaxListIndex(listRef, disabledIndices) {
201
+ return findNonDisabledListIndex(listRef, {
202
+ decrement: true,
203
+ startingIndex: listRef.current.length,
204
+ disabledIndices
205
+ });
206
+ }
207
+ function isIndexOutOfListBounds(listRef, index) {
208
+ return index < 0 || index >= listRef.current.length;
209
+ }