@tamagui/select 3.0.0-beta.922.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.
Files changed (106) hide show
  1. package/dist/cjs/Select.cjs +23 -25
  2. package/dist/cjs/Select.native.cjs +27 -26
  3. package/dist/cjs/Select.native.js +27 -26
  4. package/dist/cjs/Select.native.js.map +1 -1
  5. package/dist/cjs/SelectImpl.cjs +56 -50
  6. package/dist/cjs/SelectItem.cjs +49 -60
  7. package/dist/cjs/SelectItem.native.cjs +51 -79
  8. package/dist/cjs/SelectItem.native.js +51 -79
  9. package/dist/cjs/SelectItem.native.js.map +1 -1
  10. package/dist/cjs/SelectScrollButton.cjs +2 -2
  11. package/dist/cjs/SelectTrigger.cjs +22 -5
  12. package/dist/cjs/SelectTrigger.native.cjs +15 -5
  13. package/dist/cjs/SelectTrigger.native.js +15 -5
  14. package/dist/cjs/SelectTrigger.native.js.map +1 -1
  15. package/dist/cjs/SelectViewport.cjs +22 -30
  16. package/dist/cjs/SelectViewport.native.cjs +2 -2
  17. package/dist/cjs/SelectViewport.native.js +2 -2
  18. package/dist/cjs/SelectViewport.native.js.map +1 -1
  19. package/dist/cjs/selectionController.cjs +15 -5
  20. package/dist/cjs/selectionController.native.cjs +20 -15
  21. package/dist/cjs/selectionController.native.js +20 -15
  22. package/dist/cjs/selectionController.native.js.map +1 -1
  23. package/dist/esm/Select.mjs +27 -28
  24. package/dist/esm/Select.mjs.map +1 -1
  25. package/dist/esm/Select.native.js +31 -29
  26. package/dist/esm/Select.native.js.map +1 -1
  27. package/dist/esm/SelectImpl.mjs +56 -50
  28. package/dist/esm/SelectImpl.mjs.map +1 -1
  29. package/dist/esm/SelectItem.mjs +50 -61
  30. package/dist/esm/SelectItem.mjs.map +1 -1
  31. package/dist/esm/SelectItem.native.js +52 -80
  32. package/dist/esm/SelectItem.native.js.map +1 -1
  33. package/dist/esm/SelectScrollButton.mjs +2 -2
  34. package/dist/esm/SelectScrollButton.mjs.map +1 -1
  35. package/dist/esm/SelectTrigger.mjs +16 -5
  36. package/dist/esm/SelectTrigger.mjs.map +1 -1
  37. package/dist/esm/SelectTrigger.native.js +15 -4
  38. package/dist/esm/SelectTrigger.native.js.map +1 -1
  39. package/dist/esm/SelectViewport.mjs +22 -30
  40. package/dist/esm/SelectViewport.mjs.map +1 -1
  41. package/dist/esm/SelectViewport.native.js +3 -3
  42. package/dist/esm/SelectViewport.native.js.map +1 -1
  43. package/dist/esm/selectionController.mjs +15 -5
  44. package/dist/esm/selectionController.mjs.map +1 -1
  45. package/dist/esm/selectionController.native.js +20 -15
  46. package/dist/esm/selectionController.native.js.map +1 -1
  47. package/dist/jsx/Select.mjs +27 -28
  48. package/dist/jsx/Select.mjs.map +1 -1
  49. package/dist/jsx/Select.native.cjs +27 -26
  50. package/dist/jsx/Select.native.js +27 -26
  51. package/dist/jsx/Select.native.js.map +1 -1
  52. package/dist/jsx/SelectImpl.mjs +56 -50
  53. package/dist/jsx/SelectImpl.mjs.map +1 -1
  54. package/dist/jsx/SelectItem.mjs +50 -61
  55. package/dist/jsx/SelectItem.mjs.map +1 -1
  56. package/dist/jsx/SelectItem.native.cjs +51 -79
  57. package/dist/jsx/SelectItem.native.js +51 -79
  58. package/dist/jsx/SelectItem.native.js.map +1 -1
  59. package/dist/jsx/SelectScrollButton.mjs +2 -2
  60. package/dist/jsx/SelectScrollButton.mjs.map +1 -1
  61. package/dist/jsx/SelectTrigger.mjs +16 -5
  62. package/dist/jsx/SelectTrigger.mjs.map +1 -1
  63. package/dist/jsx/SelectTrigger.native.cjs +15 -5
  64. package/dist/jsx/SelectTrigger.native.js +15 -5
  65. package/dist/jsx/SelectTrigger.native.js.map +1 -1
  66. package/dist/jsx/SelectViewport.mjs +22 -30
  67. package/dist/jsx/SelectViewport.mjs.map +1 -1
  68. package/dist/jsx/SelectViewport.native.cjs +2 -2
  69. package/dist/jsx/SelectViewport.native.js +2 -2
  70. package/dist/jsx/SelectViewport.native.js.map +1 -1
  71. package/dist/jsx/selectionController.mjs +15 -5
  72. package/dist/jsx/selectionController.mjs.map +1 -1
  73. package/dist/jsx/selectionController.native.cjs +20 -15
  74. package/dist/jsx/selectionController.native.js +20 -15
  75. package/dist/jsx/selectionController.native.js.map +1 -1
  76. package/package.json +30 -29
  77. package/src/Select.tsx +41 -41
  78. package/src/SelectImpl.tsx +83 -81
  79. package/src/SelectItem.tsx +66 -91
  80. package/src/SelectScrollButton.tsx +2 -2
  81. package/src/SelectTrigger.tsx +19 -2
  82. package/src/SelectViewport.native.tsx +4 -4
  83. package/src/SelectViewport.tsx +21 -27
  84. package/src/selectionController.ts +20 -5
  85. package/src/types.tsx +26 -21
  86. package/types/Select.d.ts +42 -81
  87. package/types/Select.d.ts.map +1 -1
  88. package/types/SelectImpl.d.ts.map +1 -1
  89. package/types/SelectItem.d.ts +3 -5
  90. package/types/SelectItem.d.ts.map +1 -1
  91. package/types/SelectItemText.d.ts +3 -5
  92. package/types/SelectItemText.d.ts.map +1 -1
  93. package/types/SelectScrollButton.d.ts +5 -9
  94. package/types/SelectScrollButton.d.ts.map +1 -1
  95. package/types/SelectScrollButton.native.d.ts +5 -9
  96. package/types/SelectScrollButton.native.d.ts.map +1 -1
  97. package/types/SelectTrigger.d.ts +3 -5
  98. package/types/SelectTrigger.d.ts.map +1 -1
  99. package/types/SelectViewport.d.ts +4 -9
  100. package/types/SelectViewport.d.ts.map +1 -1
  101. package/types/SelectViewport.native.d.ts +4 -9
  102. package/types/SelectViewport.native.d.ts.map +1 -1
  103. package/types/selectionController.d.ts +2 -0
  104. package/types/selectionController.d.ts.map +1 -1
  105. package/types/types.d.ts +30 -21
  106. package/types/types.d.ts.map +1 -1
@@ -43,13 +43,6 @@ var import_helpers = require("@tamagui/helpers");
43
43
  var React = __toESM(require("react"), 1);
44
44
  var import_context = require("./context.native.js");
45
45
  var import_selectionController = require("./selectionController.native.js");
46
- function _instanceof(left, right) {
47
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
48
- return !!right[Symbol.hasInstance](left);
49
- } else {
50
- return left instanceof right;
51
- }
52
- }
53
46
  var ITEM_NAME = "SelectItem";
54
47
  var { Provider: SelectItemContextProvider, useStyledContext: useSelectItemContext } = (0, import_core.createStyledContext)(null, ITEM_NAME);
55
48
  var SelectItemFrame = (0, import_core.styled)(import_core.View, {
@@ -61,44 +54,22 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
61
54
  var { scope, value, disabled: disabledProp, "aria-disabled": ariaDisabled, textValue: textValueProp, ...restProps } = props;
62
55
  var disabled = disabledProp !== null && disabledProp !== void 0 ? disabledProp : ariaDisabled === true;
63
56
  var context = (0, import_context.useSelectItemParentContext)(scope);
64
- var selectContext = (0, import_context.useSelectContext)(scope);
65
- var isAdapted = (0, import_adapt.useAdaptIsActive)(selectContext.adaptScope);
66
- var { listRef, registry, mode, selectedValues, selectValue, activeIndexSubscribe, activeIndexRef, allowMouseUpRef, allowSelectRef, selectTimeoutRef, interactions, shouldRenderWebNative, setActiveIndexFast, moveActive, search } = context;
57
+ var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
58
+ var { registry, mode, selectedValues, selectValue, activeIndexSubscribe, activeIndexRef, allowMouseUpRef, allowSelectRef, selectTimeoutRef, getItemProps, shouldRenderWebNative, setActiveIndex, lastPointerRef, moveActive, search } = context;
67
59
  var isSelected = selectedValues.includes(value);
68
60
  var pendingMouseUpSelectionRef = React.useRef(false);
69
61
  var itemNodeRef = React.useRef(null);
70
- var [, rerenderRegistry] = React.useReducer(function(version) {
71
- return version + 1;
72
- }, 0);
73
62
  var registrationRef = React.useRef(null);
74
63
  var initialRegistration = React.useRef({
75
64
  value,
76
65
  disabled,
77
66
  textValue: textValueProp
78
67
  });
79
- (0, import_constants.useIsomorphicLayoutEffect)(function() {
80
- return registry.subscribe(function() {
81
- return rerenderRegistry();
82
- });
83
- }, [registry]);
84
68
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
85
69
  var registration = registry.registerItem(initialRegistration.current);
86
70
  registrationRef.current = registration;
87
- var registeredNode = itemNodeRef.current;
88
- registration.setNode(registeredNode);
89
- var registeredIndex = registry.getItems().findIndex(function(item) {
90
- return item.id === registration.id;
91
- });
92
- if (import_constants.isWeb && listRef && registeredIndex >= 0 && _instanceof(registeredNode, HTMLElement)) {
93
- listRef.current[registeredIndex] = registeredNode;
94
- }
71
+ registration.setNode(itemNodeRef.current);
95
72
  return function() {
96
- var currentIndex = registry.getItems().findIndex(function(item) {
97
- return item.id === registration.id;
98
- });
99
- if (listRef && currentIndex >= 0 && listRef.current[currentIndex] === registeredNode) {
100
- listRef.current[currentIndex] = null;
101
- }
102
73
  registrationRef.current = null;
103
74
  registration.unregister();
104
75
  };
@@ -119,39 +90,37 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
119
90
  var _registrationRef_current;
120
91
  (_registrationRef_current = registrationRef.current) === null || _registrationRef_current === void 0 ? void 0 : _registrationRef_current.setNode(itemNodeRef.current);
121
92
  });
122
- var index = registry.getIndex(value);
93
+ var [isActive, setIsActive] = React.useState(false);
94
+ var isActiveRef = React.useRef(false);
123
95
  React.useEffect(function() {
124
96
  var handleActiveIndex = function(i) {
125
- if (index === i) {
126
- if (import_constants.isWeb) {
127
- requestAnimationFrame(function() {
128
- var _listRef_current_index;
129
- listRef === null || listRef === void 0 ? void 0 : (_listRef_current_index = listRef.current[index]) === null || _listRef_current_index === void 0 ? void 0 : _listRef_current_index.focus();
130
- });
131
- }
97
+ var next = i != null && registry.getIndex(value) === i;
98
+ if (next !== isActiveRef.current) {
99
+ isActiveRef.current = next;
100
+ setIsActive(next);
101
+ }
102
+ if (next && import_constants.isWeb) {
103
+ requestAnimationFrame(function() {
104
+ var _itemNodeRef_current_focus, _itemNodeRef_current;
105
+ (_itemNodeRef_current = itemNodeRef.current) === null || _itemNodeRef_current === void 0 ? void 0 : (_itemNodeRef_current_focus = _itemNodeRef_current.focus) === null || _itemNodeRef_current_focus === void 0 ? void 0 : _itemNodeRef_current_focus.call(_itemNodeRef_current);
106
+ });
132
107
  }
133
108
  };
134
- var currentActiveIndex = activeIndexRef === null || activeIndexRef === void 0 ? void 0 : activeIndexRef.current;
135
- if (currentActiveIndex !== null && currentActiveIndex !== void 0) {
136
- handleActiveIndex(currentActiveIndex);
137
- }
109
+ var _activeIndexRef_current;
110
+ handleActiveIndex((_activeIndexRef_current = activeIndexRef === null || activeIndexRef === void 0 ? void 0 : activeIndexRef.current) !== null && _activeIndexRef_current !== void 0 ? _activeIndexRef_current : null);
138
111
  return activeIndexSubscribe(handleActiveIndex);
139
112
  }, [
140
113
  activeIndexRef,
141
114
  activeIndexSubscribe,
142
- index,
143
- listRef
115
+ registry,
116
+ value
144
117
  ]);
145
118
  var textId = React.useId();
146
119
  var refCallback = React.useCallback(function(node) {
147
120
  var _registrationRef_current;
148
121
  itemNodeRef.current = node;
149
122
  (_registrationRef_current = registrationRef.current) === null || _registrationRef_current === void 0 ? void 0 : _registrationRef_current.setNode(node);
150
- if (!import_constants.isWeb) return;
151
- if (listRef && index >= 0) {
152
- listRef.current[index] = _instanceof(node, HTMLElement) ? node : null;
153
- }
154
- }, [index, listRef]);
123
+ }, []);
155
124
  var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, refCallback);
156
125
  var handleSelect = React.useCallback(function(event) {
157
126
  var reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "item-press";
@@ -163,6 +132,27 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
163
132
  selectValue,
164
133
  value
165
134
  ]);
135
+ var handleMouseMove = React.useCallback(function(event) {
136
+ if (disabled) return;
137
+ var index = registry.getIndex(value);
138
+ if (index < 0) return;
139
+ var last = lastPointerRef.current;
140
+ if (event.clientX === last.x && event.clientY === last.y) return;
141
+ last.x = event.clientX;
142
+ last.y = event.clientY;
143
+ setActiveIndex(index, {
144
+ reason: "item-hover",
145
+ event: event.nativeEvent || event,
146
+ trigger: event.currentTarget,
147
+ index
148
+ });
149
+ }, [
150
+ disabled,
151
+ lastPointerRef,
152
+ registry,
153
+ setActiveIndex,
154
+ value
155
+ ]);
166
156
  var handleKeyDown = React.useCallback(function(event) {
167
157
  var _event_key;
168
158
  if (disabled) return;
@@ -177,7 +167,7 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
177
167
  moveActive(event.key === "ArrowDown" ? 1 : -1, event.nativeEvent || event);
178
168
  return;
179
169
  }
180
- if (!interactions && ((_event_key = event.key) === null || _event_key === void 0 ? void 0 : _event_key.length) === 1 && !event.metaKey && !event.ctrlKey) {
170
+ if (!getItemProps && ((_event_key = event.key) === null || _event_key === void 0 ? void 0 : _event_key.length) === 1 && !event.metaKey && !event.ctrlKey) {
181
171
  search(event.key, event.nativeEvent || event);
182
172
  }
183
173
  if (allowSelectRef) {
@@ -187,14 +177,14 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
187
177
  allowSelectRef,
188
178
  disabled,
189
179
  handleSelect,
190
- interactions,
180
+ getItemProps,
191
181
  moveActive,
192
182
  search
193
183
  ]);
194
184
  var selectItemProps = React.useMemo(function() {
195
- if (interactions) {
185
+ if (getItemProps) {
196
186
  var { onTouchMove, onTouchEnd, onKeyDown, onClick, onMouseUp, onMouseMove, onPress, ...itemProps } = restProps;
197
- var interactionProps = interactions.getItemProps({
187
+ var interactionProps = getItemProps({
198
188
  ...itemProps,
199
189
  onTouchMove() {
200
190
  allowSelectRef.current = true;
@@ -204,15 +194,7 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
204
194
  allowSelectRef.current = false;
205
195
  allowMouseUpRef.current = true;
206
196
  },
207
- onMouseMove(event) {
208
- if (disabled || index < 0) return;
209
- setActiveIndexFast === null || setActiveIndexFast === void 0 ? void 0 : setActiveIndexFast(index, {
210
- reason: "item-hover",
211
- event: event.nativeEvent || event,
212
- trigger: event.currentTarget,
213
- index
214
- });
215
- },
197
+ onMouseMove: handleMouseMove,
216
198
  onKeyDown: handleKeyDown,
217
199
  onClick(event) {
218
200
  if (disabled) return;
@@ -266,15 +248,7 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
266
248
  return {
267
249
  ...restProps,
268
250
  onKeyDown: (0, import_helpers.composeEventHandlers)(restProps.onKeyDown, handleKeyDown),
269
- onMouseMove: (0, import_helpers.composeEventHandlers)(restProps.onMouseMove, function(event) {
270
- if (disabled || index < 0) return;
271
- setActiveIndexFast === null || setActiveIndexFast === void 0 ? void 0 : setActiveIndexFast(index, {
272
- reason: "item-hover",
273
- event: event.nativeEvent || event,
274
- trigger: event.currentTarget,
275
- index
276
- });
277
- }),
251
+ onMouseMove: (0, import_helpers.composeEventHandlers)(restProps.onMouseMove, handleMouseMove),
278
252
  onPress: (0, import_helpers.composeEventHandlers)(restProps.onPress, handleSelect)
279
253
  };
280
254
  }, [
@@ -282,15 +256,13 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
282
256
  allowSelectRef,
283
257
  disabled,
284
258
  handleKeyDown,
259
+ handleMouseMove,
285
260
  handleSelect,
286
- index,
287
- interactions,
261
+ getItemProps,
288
262
  restProps,
289
- selectTimeoutRef,
290
- setActiveIndexFast
263
+ selectTimeoutRef
291
264
  ]);
292
265
  var accessibilityProps = (0, import_selectionController.getSelectOptionProps)(mode, isSelected, disabled, import_constants.isWeb ? "web" : "native");
293
- var _selectContext_activeIndex;
294
266
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemContextProvider, {
295
267
  scope,
296
268
  value,
@@ -307,7 +279,7 @@ var SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function Sele
307
279
  "aria-labelledby": textId,
308
280
  "data-state": isSelected ? "active" : "inactive",
309
281
  "data-disabled": disabled ? "" : void 0,
310
- tabIndex: disabled ? void 0 : import_constants.isWeb && isAdapted ? index === ((_selectContext_activeIndex = selectContext.activeIndex) !== null && _selectContext_activeIndex !== void 0 ? _selectContext_activeIndex : selectContext.selectedIndex) ? 0 : -1 : -1,
282
+ tabIndex: disabled ? void 0 : import_constants.isWeb && isAdapted && (isActive || (activeIndexRef === null || activeIndexRef === void 0 ? void 0 : activeIndexRef.current) == null && isSelected) ? 0 : -1,
311
283
  zIndex: 100,
312
284
  ...selectItemProps,
313
285
  ...accessibilityProps
@@ -1 +1 @@
1
- {"version":3,"file":"SelectItem.native.js","names":[],"sources":["cjs/SelectItem.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SelectItem_exports = {};\n__export(SelectItem_exports, {\n SelectItem: () => SelectItem,\n SelectItemContextProvider: () => SelectItemContextProvider,\n SelectItemFrame: () => SelectItemFrame,\n useSelectItemContext: () => useSelectItemContext\n});\nmodule.exports = __toCommonJS(SelectItem_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_adapt = require(\"@tamagui/adapt\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar import_selectionController = require(\"./selectionController\");\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}\nvar ITEM_NAME = \"SelectItem\";\nvar { Provider: SelectItemContextProvider, useStyledContext: useSelectItemContext } = (0, import_core.createStyledContext)(null, ITEM_NAME);\nvar SelectItemFrame = (0, import_core.styled)(import_core.View, {\n displayName: ITEM_NAME,\n alignItems: \"center\",\n flexDirection: \"row\"\n});\nvar SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function SelectItem2(props, forwardedRef) {\n var { scope, value, disabled: disabledProp, \"aria-disabled\": ariaDisabled, textValue: textValueProp, ...restProps } = props;\n var disabled = disabledProp !== null && disabledProp !== void 0 ? disabledProp : ariaDisabled === true;\n var context = (0, import_context.useSelectItemParentContext)(scope);\n var selectContext = (0, import_context.useSelectContext)(scope);\n var isAdapted = (0, import_adapt.useAdaptIsActive)(selectContext.adaptScope);\n var { listRef, registry, mode, selectedValues, selectValue, activeIndexSubscribe, activeIndexRef, allowMouseUpRef, allowSelectRef, selectTimeoutRef, interactions, shouldRenderWebNative, setActiveIndexFast, moveActive, search } = context;\n var isSelected = selectedValues.includes(value);\n var pendingMouseUpSelectionRef = React.useRef(false);\n var itemNodeRef = React.useRef(null);\n var [, rerenderRegistry] = React.useReducer(function(version) {\n return version + 1;\n }, 0);\n var registrationRef = React.useRef(null);\n var initialRegistration = React.useRef({\n value,\n disabled,\n textValue: textValueProp\n });\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n return registry.subscribe(function() {\n return rerenderRegistry();\n });\n }, [\n registry\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var registration = registry.registerItem(initialRegistration.current);\n registrationRef.current = registration;\n var registeredNode = itemNodeRef.current;\n registration.setNode(registeredNode);\n var registeredIndex = registry.getItems().findIndex(function(item) {\n return item.id === registration.id;\n });\n if (import_constants.isWeb && listRef && registeredIndex >= 0 && _instanceof(registeredNode, HTMLElement)) {\n listRef.current[registeredIndex] = registeredNode;\n }\n return function() {\n var currentIndex = registry.getItems().findIndex(function(item) {\n return item.id === registration.id;\n });\n if (listRef && currentIndex >= 0 && listRef.current[currentIndex] === registeredNode) {\n listRef.current[currentIndex] = null;\n }\n registrationRef.current = null;\n registration.unregister();\n };\n }, [\n registry\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var _registrationRef_current;\n (_registrationRef_current = registrationRef.current) === null || _registrationRef_current === void 0 ? void 0 : _registrationRef_current.update({\n value,\n disabled,\n textValue: textValueProp\n });\n }, [\n disabled,\n textValueProp,\n value\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var _registrationRef_current;\n (_registrationRef_current = registrationRef.current) === null || _registrationRef_current === void 0 ? void 0 : _registrationRef_current.setNode(itemNodeRef.current);\n });\n var index = registry.getIndex(value);\n React.useEffect(function() {\n var handleActiveIndex = function(i) {\n if (index === i) {\n if (import_constants.isWeb) {\n requestAnimationFrame(function() {\n var _listRef_current_index;\n listRef === null || listRef === void 0 ? void 0 : (_listRef_current_index = listRef.current[index]) === null || _listRef_current_index === void 0 ? void 0 : _listRef_current_index.focus();\n });\n }\n }\n };\n var currentActiveIndex = activeIndexRef === null || activeIndexRef === void 0 ? void 0 : activeIndexRef.current;\n if (currentActiveIndex !== null && currentActiveIndex !== void 0) {\n handleActiveIndex(currentActiveIndex);\n }\n return activeIndexSubscribe(handleActiveIndex);\n }, [\n activeIndexRef,\n activeIndexSubscribe,\n index,\n listRef\n ]);\n var textId = React.useId();\n var refCallback = React.useCallback(function(node) {\n var _registrationRef_current;\n itemNodeRef.current = node;\n (_registrationRef_current = registrationRef.current) === null || _registrationRef_current === void 0 ? void 0 : _registrationRef_current.setNode(node);\n if (!import_constants.isWeb) return;\n if (listRef && index >= 0) {\n listRef.current[index] = _instanceof(node, HTMLElement) ? node : null;\n }\n }, [\n index,\n listRef\n ]);\n var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, refCallback);\n var handleSelect = React.useCallback(function(event) {\n var reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"item-press\";\n if (disabled) return;\n var nativeEvent = (event === null || event === void 0 ? void 0 : event.nativeEvent) || event;\n selectValue(value, (0, import_core.createChangeEventDetails)(reason, nativeEvent, event === null || event === void 0 ? void 0 : event.currentTarget));\n }, [\n disabled,\n selectValue,\n value\n ]);\n var handleKeyDown = React.useCallback(function(event) {\n var _event_key;\n if (disabled) return;\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n handleSelect(event, \"keyboard\");\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n event.stopPropagation();\n moveActive(event.key === \"ArrowDown\" ? 1 : -1, event.nativeEvent || event);\n return;\n }\n if (!interactions && ((_event_key = event.key) === null || _event_key === void 0 ? void 0 : _event_key.length) === 1 && !event.metaKey && !event.ctrlKey) {\n search(event.key, event.nativeEvent || event);\n }\n if (allowSelectRef) {\n allowSelectRef.current = true;\n }\n }, [\n allowSelectRef,\n disabled,\n handleSelect,\n interactions,\n moveActive,\n search\n ]);\n var selectItemProps = React.useMemo(function() {\n if (interactions) {\n var { onTouchMove, onTouchEnd, onKeyDown, onClick, onMouseUp, onMouseMove, onPress, ...itemProps } = restProps;\n var interactionProps = interactions.getItemProps({\n ...itemProps,\n onTouchMove() {\n allowSelectRef.current = true;\n allowMouseUpRef.current = false;\n },\n onTouchEnd() {\n allowSelectRef.current = false;\n allowMouseUpRef.current = true;\n },\n onMouseMove(event) {\n if (disabled || index < 0) return;\n setActiveIndexFast === null || setActiveIndexFast === void 0 ? void 0 : setActiveIndexFast(index, {\n reason: \"item-hover\",\n event: event.nativeEvent || event,\n trigger: event.currentTarget,\n index\n });\n },\n onKeyDown: handleKeyDown,\n onClick(event) {\n if (disabled) return;\n var shouldSelect = pendingMouseUpSelectionRef.current || allowSelectRef.current;\n pendingMouseUpSelectionRef.current = false;\n clearTimeout(selectTimeoutRef.current);\n allowSelectRef.current = true;\n if (shouldSelect) {\n handleSelect(event);\n }\n },\n onMouseUp(event) {\n if (disabled) return;\n if (!allowMouseUpRef.current) {\n allowMouseUpRef.current = true;\n allowSelectRef.current = true;\n return;\n }\n pendingMouseUpSelectionRef.current = allowSelectRef.current;\n clearTimeout(selectTimeoutRef.current);\n selectTimeoutRef.current = setTimeout(function() {\n allowSelectRef.current = true;\n if (pendingMouseUpSelectionRef.current) {\n pendingMouseUpSelectionRef.current = false;\n handleSelect(event);\n }\n });\n }\n });\n return {\n ...interactionProps,\n onTouchMove: (0, import_helpers.composeEventHandlers)(onTouchMove, interactionProps.onTouchMove),\n onTouchEnd: (0, import_helpers.composeEventHandlers)(onTouchEnd, interactionProps.onTouchEnd),\n onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, interactionProps.onKeyDown),\n onClick(event) {\n var _interactionProps_onClick;\n onClick === null || onClick === void 0 ? void 0 : onClick(event);\n if (event.defaultPrevented) {\n pendingMouseUpSelectionRef.current = false;\n clearTimeout(selectTimeoutRef.current);\n allowSelectRef.current = true;\n return;\n }\n (_interactionProps_onClick = interactionProps.onClick) === null || _interactionProps_onClick === void 0 ? void 0 : _interactionProps_onClick.call(interactionProps, event);\n },\n onMouseUp: (0, import_helpers.composeEventHandlers)(onMouseUp, interactionProps.onMouseUp),\n onMouseMove: (0, import_helpers.composeEventHandlers)(onMouseMove, interactionProps.onMouseMove),\n onPress\n };\n }\n return {\n ...restProps,\n onKeyDown: (0, import_helpers.composeEventHandlers)(restProps.onKeyDown, handleKeyDown),\n onMouseMove: (0, import_helpers.composeEventHandlers)(restProps.onMouseMove, function(event) {\n if (disabled || index < 0) return;\n setActiveIndexFast === null || setActiveIndexFast === void 0 ? void 0 : setActiveIndexFast(index, {\n reason: \"item-hover\",\n event: event.nativeEvent || event,\n trigger: event.currentTarget,\n index\n });\n }),\n onPress: (0, import_helpers.composeEventHandlers)(restProps.onPress, handleSelect)\n };\n }, [\n allowMouseUpRef,\n allowSelectRef,\n disabled,\n handleKeyDown,\n handleSelect,\n index,\n interactions,\n restProps,\n selectTimeoutRef,\n setActiveIndexFast\n ]);\n var accessibilityProps = (0, import_selectionController.getSelectOptionProps)(mode, isSelected, disabled, import_constants.isWeb ? \"web\" : \"native\");\n var _selectContext_activeIndex;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemContextProvider, {\n scope,\n value,\n textId: textId || \"\",\n textValue: textValueProp,\n isSelected,\n children: shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"option\", {\n value,\n disabled,\n children: props.children\n }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemFrame, {\n render: \"div\",\n ref: composedRefs,\n \"aria-labelledby\": textId,\n \"data-state\": isSelected ? \"active\" : \"inactive\",\n \"data-disabled\": disabled ? \"\" : void 0,\n tabIndex: disabled ? void 0 : import_constants.isWeb && isAdapted ? index === ((_selectContext_activeIndex = selectContext.activeIndex) !== null && _selectContext_activeIndex !== void 0 ? _selectContext_activeIndex : selectContext.selectedIndex) ? 0 : -1 : -1,\n zIndex: 100,\n ...selectItemProps,\n ...accessibilityProps\n })\n });\n}, {\n disableTheme: true\n});\n//# sourceMappingURL=SelectItem.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAA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I,YAAY,QAAQ,GAAG;IAC3B,uBAAuB,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,OAAO;KAChG,QAAQ;KACR,OAAO,MAAM,eAAe;KAC5B,SAAS,MAAM;KACf;IACF,CAAC;GACH,CAAC;GACD,UAAU,GAAG,eAAe,qBAAoB,CAAE,UAAU,SAAS,YAAY;EACnF;CACF,GAAG;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,IAAI,sBAAsB,GAAG,2BAA2B,qBAAoB,CAAE,MAAM,YAAY,UAAU,iBAAiB,QAAQ,QAAQ,QAAQ;CACnJ,IAAI;CACJ,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,2BAA2B;EAC5E;EACA;EACA,QAAQ,UAAU;EAClB,WAAW;EACX;EACA,UAAU,wBAAwC,iBAAC,GAAG,mBAAmB,IAAG,CAAE,UAAU;GACtF;GACA;GACA,UAAU,MAAM;EAClB,CAAC,IAAoB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,iBAAiB;GAChE,QAAQ;GACR,KAAK;GACL,mBAAmB;GACnB,cAAc,aAAa,WAAW;GACtC,iBAAiB,WAAW,KAAK,KAAK;GACtC,UAAU,WAAW,KAAK,IAAI,iBAAiB,SAAS,YAAY,YAAY,6BAA6B,cAAc,iBAAiB,QAAQ,+BAA+B,KAAK,IAAI,6BAA6B,cAAc,iBAAiB,IAAI,CAAC,IAAI,CAAC;GAClQ,QAAQ;GACR,GAAG;GACH,GAAG;EACL,CAAC;CACH,CAAC;AACH,GAAG,EACD,cAAc,KAChB,CAAC"}
1
+ {"version":3,"file":"SelectItem.native.js","names":[],"sources":["cjs/SelectItem.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SelectItem_exports = {};\n__export(SelectItem_exports, {\n SelectItem: () => SelectItem,\n SelectItemContextProvider: () => SelectItemContextProvider,\n SelectItemFrame: () => SelectItemFrame,\n useSelectItemContext: () => useSelectItemContext\n});\nmodule.exports = __toCommonJS(SelectItem_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_adapt = require(\"@tamagui/adapt\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar import_selectionController = require(\"./selectionController\");\nvar ITEM_NAME = \"SelectItem\";\nvar { Provider: SelectItemContextProvider, useStyledContext: useSelectItemContext } = (0, import_core.createStyledContext)(null, ITEM_NAME);\nvar SelectItemFrame = (0, import_core.styled)(import_core.View, {\n displayName: ITEM_NAME,\n alignItems: \"center\",\n flexDirection: \"row\"\n});\nvar SelectItem = (0, import_core.createStyledHOC)(SelectItemFrame, function SelectItem2(props, forwardedRef) {\n var { scope, value, disabled: disabledProp, \"aria-disabled\": ariaDisabled, textValue: textValueProp, ...restProps } = props;\n var disabled = disabledProp !== null && disabledProp !== void 0 ? disabledProp : ariaDisabled === true;\n var context = (0, import_context.useSelectItemParentContext)(scope);\n var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);\n var { registry, mode, selectedValues, selectValue, activeIndexSubscribe, activeIndexRef, allowMouseUpRef, allowSelectRef, selectTimeoutRef, getItemProps, shouldRenderWebNative, setActiveIndex, lastPointerRef, moveActive, search } = context;\n var isSelected = selectedValues.includes(value);\n var pendingMouseUpSelectionRef = React.useRef(false);\n var itemNodeRef = React.useRef(null);\n var registrationRef = React.useRef(null);\n var initialRegistration = React.useRef({\n value,\n disabled,\n textValue: textValueProp\n });\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var registration = registry.registerItem(initialRegistration.current);\n registrationRef.current = registration;\n registration.setNode(itemNodeRef.current);\n return function() {\n registrationRef.current = null;\n registration.unregister();\n };\n }, [\n registry\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var _registrationRef_current;\n (_registrationRef_current = registrationRef.current) === null || _registrationRef_current === void 0 ? void 0 : _registrationRef_current.update({\n value,\n disabled,\n textValue: textValueProp\n });\n }, [\n disabled,\n textValueProp,\n value\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var _registrationRef_current;\n (_registrationRef_current = registrationRef.current) === null || _registrationRef_current === void 0 ? void 0 : _registrationRef_current.setNode(itemNodeRef.current);\n });\n var [isActive, setIsActive] = React.useState(false);\n var isActiveRef = React.useRef(false);\n React.useEffect(function() {\n var handleActiveIndex = function(i) {\n var next = i != null && registry.getIndex(value) === i;\n if (next !== isActiveRef.current) {\n isActiveRef.current = next;\n setIsActive(next);\n }\n if (next && import_constants.isWeb) {\n requestAnimationFrame(function() {\n var _itemNodeRef_current_focus, _itemNodeRef_current;\n (_itemNodeRef_current = itemNodeRef.current) === null || _itemNodeRef_current === void 0 ? void 0 : (_itemNodeRef_current_focus = _itemNodeRef_current.focus) === null || _itemNodeRef_current_focus === void 0 ? void 0 : _itemNodeRef_current_focus.call(_itemNodeRef_current);\n });\n }\n };\n var _activeIndexRef_current;\n handleActiveIndex((_activeIndexRef_current = activeIndexRef === null || activeIndexRef === void 0 ? void 0 : activeIndexRef.current) !== null && _activeIndexRef_current !== void 0 ? _activeIndexRef_current : null);\n return activeIndexSubscribe(handleActiveIndex);\n }, [\n activeIndexRef,\n activeIndexSubscribe,\n registry,\n value\n ]);\n var textId = React.useId();\n var refCallback = React.useCallback(function(node) {\n var _registrationRef_current;\n itemNodeRef.current = node;\n (_registrationRef_current = registrationRef.current) === null || _registrationRef_current === void 0 ? void 0 : _registrationRef_current.setNode(node);\n }, []);\n var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, refCallback);\n var handleSelect = React.useCallback(function(event) {\n var reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"item-press\";\n if (disabled) return;\n var nativeEvent = (event === null || event === void 0 ? void 0 : event.nativeEvent) || event;\n selectValue(value, (0, import_core.createChangeEventDetails)(reason, nativeEvent, event === null || event === void 0 ? void 0 : event.currentTarget));\n }, [\n disabled,\n selectValue,\n value\n ]);\n var handleMouseMove = React.useCallback(function(event) {\n if (disabled) return;\n var index = registry.getIndex(value);\n if (index < 0) return;\n var last = lastPointerRef.current;\n if (event.clientX === last.x && event.clientY === last.y) return;\n last.x = event.clientX;\n last.y = event.clientY;\n setActiveIndex(index, {\n reason: \"item-hover\",\n event: event.nativeEvent || event,\n trigger: event.currentTarget,\n index\n });\n }, [\n disabled,\n lastPointerRef,\n registry,\n setActiveIndex,\n value\n ]);\n var handleKeyDown = React.useCallback(function(event) {\n var _event_key;\n if (disabled) return;\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n handleSelect(event, \"keyboard\");\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n event.stopPropagation();\n moveActive(event.key === \"ArrowDown\" ? 1 : -1, event.nativeEvent || event);\n return;\n }\n if (!getItemProps && ((_event_key = event.key) === null || _event_key === void 0 ? void 0 : _event_key.length) === 1 && !event.metaKey && !event.ctrlKey) {\n search(event.key, event.nativeEvent || event);\n }\n if (allowSelectRef) {\n allowSelectRef.current = true;\n }\n }, [\n allowSelectRef,\n disabled,\n handleSelect,\n getItemProps,\n moveActive,\n search\n ]);\n var selectItemProps = React.useMemo(function() {\n if (getItemProps) {\n var { onTouchMove, onTouchEnd, onKeyDown, onClick, onMouseUp, onMouseMove, onPress, ...itemProps } = restProps;\n var interactionProps = getItemProps({\n ...itemProps,\n onTouchMove() {\n allowSelectRef.current = true;\n allowMouseUpRef.current = false;\n },\n onTouchEnd() {\n allowSelectRef.current = false;\n allowMouseUpRef.current = true;\n },\n onMouseMove: handleMouseMove,\n onKeyDown: handleKeyDown,\n onClick(event) {\n if (disabled) return;\n var shouldSelect = pendingMouseUpSelectionRef.current || allowSelectRef.current;\n pendingMouseUpSelectionRef.current = false;\n clearTimeout(selectTimeoutRef.current);\n allowSelectRef.current = true;\n if (shouldSelect) {\n handleSelect(event);\n }\n },\n onMouseUp(event) {\n if (disabled) return;\n if (!allowMouseUpRef.current) {\n allowMouseUpRef.current = true;\n allowSelectRef.current = true;\n return;\n }\n pendingMouseUpSelectionRef.current = allowSelectRef.current;\n clearTimeout(selectTimeoutRef.current);\n selectTimeoutRef.current = setTimeout(function() {\n allowSelectRef.current = true;\n if (pendingMouseUpSelectionRef.current) {\n pendingMouseUpSelectionRef.current = false;\n handleSelect(event);\n }\n });\n }\n });\n return {\n ...interactionProps,\n onTouchMove: (0, import_helpers.composeEventHandlers)(onTouchMove, interactionProps.onTouchMove),\n onTouchEnd: (0, import_helpers.composeEventHandlers)(onTouchEnd, interactionProps.onTouchEnd),\n onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, interactionProps.onKeyDown),\n onClick(event) {\n var _interactionProps_onClick;\n onClick === null || onClick === void 0 ? void 0 : onClick(event);\n if (event.defaultPrevented) {\n pendingMouseUpSelectionRef.current = false;\n clearTimeout(selectTimeoutRef.current);\n allowSelectRef.current = true;\n return;\n }\n (_interactionProps_onClick = interactionProps.onClick) === null || _interactionProps_onClick === void 0 ? void 0 : _interactionProps_onClick.call(interactionProps, event);\n },\n onMouseUp: (0, import_helpers.composeEventHandlers)(onMouseUp, interactionProps.onMouseUp),\n onMouseMove: (0, import_helpers.composeEventHandlers)(onMouseMove, interactionProps.onMouseMove),\n onPress\n };\n }\n return {\n ...restProps,\n onKeyDown: (0, import_helpers.composeEventHandlers)(restProps.onKeyDown, handleKeyDown),\n onMouseMove: (0, import_helpers.composeEventHandlers)(restProps.onMouseMove, handleMouseMove),\n onPress: (0, import_helpers.composeEventHandlers)(restProps.onPress, handleSelect)\n };\n }, [\n allowMouseUpRef,\n allowSelectRef,\n disabled,\n handleKeyDown,\n handleMouseMove,\n handleSelect,\n getItemProps,\n restProps,\n selectTimeoutRef\n ]);\n var accessibilityProps = (0, import_selectionController.getSelectOptionProps)(mode, isSelected, disabled, import_constants.isWeb ? \"web\" : \"native\");\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemContextProvider, {\n scope,\n value,\n textId: textId || \"\",\n textValue: textValueProp,\n isSelected,\n children: shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"option\", {\n value,\n disabled,\n children: props.children\n }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemFrame, {\n render: \"div\",\n ref: composedRefs,\n \"aria-labelledby\": textId,\n \"data-state\": isSelected ? \"active\" : \"inactive\",\n \"data-disabled\": disabled ? \"\" : void 0,\n tabIndex: disabled ? void 0 : import_constants.isWeb && isAdapted && (isActive || (activeIndexRef === null || activeIndexRef === void 0 ? void 0 : activeIndexRef.current) == null && isSelected) ? 0 : -1,\n zIndex: 100,\n ...selectItemProps,\n ...acc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B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,iBAAiB;GAChE,QAAQ;GACR,KAAK;GACL,mBAAmB;GACnB,cAAc,aAAa,WAAW;GACtC,iBAAiB,WAAW,KAAK,KAAK;GACtC,UAAU,WAAW,KAAK,IAAI,iBAAiB,SAAS,cAAc,aAAa,mBAAmB,QAAQ,mBAAmB,KAAK,IAAI,KAAK,IAAI,eAAe,YAAY,QAAQ,cAAc,IAAI,CAAC;GACzM,QAAQ;GACR,GAAG;GACH,GAAG;EACL,CAAC;CACH,CAAC;AACH,GAAG,EACD,cAAc,KAChB,CAAC"}
@@ -63,7 +63,7 @@ SelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
63
63
  const SelectScrollButtonImpl = React.memo((0, import_core.createStyledHOC)(SelectScrollButtonFrame, (props, forwardedRef) => {
64
64
  const { scope, dir, partClassName, ...scrollIndicatorProps } = props;
65
65
  const { className, onPointerEnter, onPointerLeave, ...frameProps } = scrollIndicatorProps;
66
- const { open, fallback, setScrollTop, setInnerOffset, ...context } = (0, import_context.useSelectContext)(scope);
66
+ const { open, fallback, updateScrollArrows, setInnerOffset, ...context } = (0, import_context.useSelectContext)(scope);
67
67
  const floatingRef = context.floatingContext?.refs.floating;
68
68
  const statusRef = React.useRef("idle");
69
69
  const isVisible = context[dir === "down" ? "canScrollDown" : "canScrollUp"];
@@ -92,7 +92,7 @@ const SelectScrollButtonImpl = React.memo((0, import_core.createStyledHOC)(Selec
92
92
  if (fallback) {
93
93
  if (floating.current) {
94
94
  floating.current.scrollTop -= amount;
95
- (0, import_react_dom.flushSync)(() => setScrollTop(floating.current?.scrollTop ?? 0));
95
+ updateScrollArrows();
96
96
  }
97
97
  } else {
98
98
  (0, import_react_dom.flushSync)(() => setInnerOffset((value) => value - amount));
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all) __defProp(target, name, {
@@ -17,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
17
19
  }
18
20
  return to;
19
21
  };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
20
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
27
  var SelectTrigger_exports = {};
22
28
  __export(SelectTrigger_exports, {
@@ -28,6 +34,7 @@ var import_compose_refs = require("@tamagui/compose-refs");
28
34
  var import_constants = require("@tamagui/constants");
29
35
  var import_core = require("@tamagui/core");
30
36
  var import_helpers = require("@tamagui/helpers");
37
+ var React = __toESM(require("react"), 1);
31
38
  var import_context = require("./context.cjs");
32
39
  var import_jsx_runtime = require("react/jsx-runtime");
33
40
  const SelectTriggerFrame = (0, import_core.styled)(import_core.View, {
@@ -41,19 +48,29 @@ const SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, funct
41
48
  const context = (0, import_context.useSelectContext)(scope);
42
49
  const itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
43
50
  const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.floatingContext?.refs.setReference);
51
+ const pressIsTouch = React.useRef(false);
44
52
  if (itemParentContext.shouldRenderWebNative) return null;
45
53
  const toggleOpen = (event, reason = "trigger-press") => {
46
54
  if (!disabled) itemParentContext.requestOpenChange(!context.open, (0, import_core.createChangeEventDetails)(reason, event?.nativeEvent || event, event?.currentTarget));
47
55
  };
48
- const interactionProps = itemParentContext.interactions ? itemParentContext.interactions.getReferenceProps({
56
+ const interactionProps = context.interactions ? context.interactions.getReferenceProps({
49
57
  ...triggerProps,
50
58
  onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, () => context.floatingContext?.update?.())
51
59
  }) : {
52
60
  ...triggerProps,
53
- ...import_constants.isWeb ? { onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, (event) => {
54
- event.preventDefault();
55
- toggleOpen(event);
56
- }) } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
61
+ ...import_constants.isWeb ? {
62
+ onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, (event) => {
63
+ pressIsTouch.current = event.type === "touchstart";
64
+ if (pressIsTouch.current) return;
65
+ event.preventDefault();
66
+ toggleOpen(event);
67
+ }),
68
+ onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, (event) => {
69
+ if (!pressIsTouch.current) return;
70
+ pressIsTouch.current = false;
71
+ toggleOpen(event);
72
+ })
73
+ } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
57
74
  onKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, (event) => {
58
75
  if (event.key === "Enter" || event.key === " ") {
59
76
  event.preventDefault();
@@ -37,7 +37,7 @@ var import_compose_refs = require("@tamagui/compose-refs");
37
37
  var import_constants = require("@tamagui/constants");
38
38
  var import_core = require("@tamagui/core");
39
39
  var import_helpers = require("@tamagui/helpers");
40
- __toESM(require("react"), 1);
40
+ var React = __toESM(require("react"), 1);
41
41
  var import_context = require("./context.native.js");
42
42
  var SelectTriggerFrame = (0, import_core.styled)(import_core.View, {
43
43
  displayName: "SelectTrigger",
@@ -51,6 +51,7 @@ var SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, functio
51
51
  var context = (0, import_context.useSelectContext)(scope);
52
52
  var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
53
53
  var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);
54
+ var pressIsTouch = React.useRef(false);
54
55
  if (itemParentContext.shouldRenderWebNative) return null;
55
56
  var toggleOpen = function(event) {
56
57
  var reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "trigger-press";
@@ -58,10 +59,19 @@ var SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, functio
58
59
  };
59
60
  var interactionProps = {
60
61
  ...triggerProps,
61
- ...import_constants.isWeb ? { onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {
62
- event.preventDefault();
63
- toggleOpen(event);
64
- }) } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
62
+ ...import_constants.isWeb ? {
63
+ onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {
64
+ pressIsTouch.current = event.type === "touchstart";
65
+ if (pressIsTouch.current) return;
66
+ event.preventDefault();
67
+ toggleOpen(event);
68
+ }),
69
+ onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, function(event) {
70
+ if (!pressIsTouch.current) return;
71
+ pressIsTouch.current = false;
72
+ toggleOpen(event);
73
+ })
74
+ } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
65
75
  onKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, function(event) {
66
76
  if (event.key === "Enter" || event.key === " ") {
67
77
  event.preventDefault();
@@ -37,7 +37,7 @@ var import_compose_refs = require("@tamagui/compose-refs");
37
37
  var import_constants = require("@tamagui/constants");
38
38
  var import_core = require("@tamagui/core");
39
39
  var import_helpers = require("@tamagui/helpers");
40
- __toESM(require("react"), 1);
40
+ var React = __toESM(require("react"), 1);
41
41
  var import_context = require("./context.native.js");
42
42
  var SelectTriggerFrame = (0, import_core.styled)(import_core.View, {
43
43
  displayName: "SelectTrigger",
@@ -51,6 +51,7 @@ var SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, functio
51
51
  var context = (0, import_context.useSelectContext)(scope);
52
52
  var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
53
53
  var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);
54
+ var pressIsTouch = React.useRef(false);
54
55
  if (itemParentContext.shouldRenderWebNative) return null;
55
56
  var toggleOpen = function(event) {
56
57
  var reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "trigger-press";
@@ -58,10 +59,19 @@ var SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, functio
58
59
  };
59
60
  var interactionProps = {
60
61
  ...triggerProps,
61
- ...import_constants.isWeb ? { onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {
62
- event.preventDefault();
63
- toggleOpen(event);
64
- }) } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
62
+ ...import_constants.isWeb ? {
63
+ onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {
64
+ pressIsTouch.current = event.type === "touchstart";
65
+ if (pressIsTouch.current) return;
66
+ event.preventDefault();
67
+ toggleOpen(event);
68
+ }),
69
+ onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, function(event) {
70
+ if (!pressIsTouch.current) return;
71
+ pressIsTouch.current = false;
72
+ toggleOpen(event);
73
+ })
74
+ } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
65
75
  onKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, function(event) {
66
76
  if (event.key === "Enter" || event.key === " ") {
67
77
  event.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTrigger.native.js","names":[],"sources":["cjs/SelectTrigger.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SelectTrigger_exports = {};\n__export(SelectTrigger_exports, {\n\tSelectTrigger: () => SelectTrigger,\n\tSelectTriggerFrame: () => SelectTriggerFrame\n});\nmodule.exports = __toCommonJS(SelectTrigger_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\n__toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar SelectTriggerFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"SelectTrigger\",\n\talignItems: \"center\",\n\tflexDirection: \"row\",\n\trender: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", { type: \"button\" })\n});\nvar SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, function SelectTrigger2(props, forwardedRef) {\n\tvar _context_floatingContext;\n\tvar { scope, disabled = false, ...triggerProps } = props;\n\tvar context = (0, import_context.useSelectContext)(scope);\n\tvar itemParentContext = (0, import_context.useSelectItemParentContext)(scope);\n\tvar composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);\n\tif (itemParentContext.shouldRenderWebNative) return null;\n\tvar toggleOpen = function(event) {\n\t\tvar reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"trigger-press\";\n\t\tif (!disabled) itemParentContext.requestOpenChange(!context.open, (0, import_core.createChangeEventDetails)(reason, (event === null || event === void 0 ? void 0 : event.nativeEvent) || event, event === null || event === void 0 ? void 0 : event.currentTarget));\n\t};\n\tvar interactionProps = {\n\t\t...triggerProps,\n\t\t...import_constants.isWeb ? { onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {\n\t\t\tevent.preventDefault();\n\t\t\ttoggleOpen(event);\n\t\t}) } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },\n\t\tonKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, function(event) {\n\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleOpen(event, \"keyboard\");\n\t\t\t}\n\t\t})\n\t};\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTriggerFrame, {\n\t\ttype: \"button\",\n\t\tid: itemParentContext.id,\n\t\trole: \"combobox\",\n\t\t\"aria-haspopup\": \"listbox\",\n\t\t\"aria-expanded\": context.open,\n\t\t\"aria-autocomplete\": \"none\",\n\t\taccessibilityRole: import_constants.isWeb ? void 0 : \"button\",\n\t\taccessibilityState: import_constants.isWeb ? void 0 : {\n\t\t\texpanded: context.open,\n\t\t\tdisabled\n\t\t},\n\t\tdir: context.dir,\n\t\tdisabled,\n\t\t\"data-disabled\": disabled ? \"\" : void 0,\n\t\t...interactionProps,\n\t\tref: composedRefs\n\t});\n});\n//# sourceMappingURL=SelectTrigger.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC/B,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;AACF;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC7C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EACnE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QAAQ,UAAU,IAAI,KAAK;GAC9G,WAAW,KAAK;GAChB,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAC3D,CAAC;CACF;CACA,OAAO;AACR;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKpG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CACpE,OAAO;CACP,YAAY;AACb,CAAC,IAAI,QACL,GACD;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB;CAC/B,qBAAqB;CACrB,0BAA0B;AAC3B,CAAC;AACD,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G;EACH,GAAG,iBAAiB,QAAQ,EAAE,cAAc,GAAG,eAAe,qBAAoB,CAAE,aAAa,aAAa,SAAS,OAAO;GAC7H,MAAM,eAAe;GACrB,WAAW,KAAK;EACjB,CAAC,EAAE,IAAI,EAAE,UAAU,GAAG,eAAe,qBAAoB,CAAE,aAAa,SAAS,UAAU,EAAE;EAC7F,YAAY,GAAG,eAAe,qBAAoB,CAAE,aAAa,WAAW,SAAS,OAAO;GAC3F,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;IAC/C,MAAM,eAAe;IACrB,WAAW,OAAO,UAAU;GAC7B;EACD,CAAC;CACF;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB;EACtE,MAAM;EACN,IAAI,kBAAkB;EACtB,MAAM;EACN,iBAAiB;EACjB,iBAAiB,QAAQ;EACzB,qBAAqB;EACrB,mBAAmB,iBAAiB,QAAQ,KAAK,IAAI;EACrD,oBAAoB,iBAAiB,QAAQ,KAAK,IAAI;GACrD,UAAU,QAAQ;GAClB;EACD;EACA,KAAK,QAAQ;EACb;EACA,iBAAiB,WAAW,KAAK,KAAK;EACtC,GAAG;EACH,KAAK;CACN,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"SelectTrigger.native.js","names":[],"sources":["cjs/SelectTrigger.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SelectTrigger_exports = {};\n__export(SelectTrigger_exports, {\n\tSelectTrigger: () => SelectTrigger,\n\tSelectTriggerFrame: () => SelectTriggerFrame\n});\nmodule.exports = __toCommonJS(SelectTrigger_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar SelectTriggerFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"SelectTrigger\",\n\talignItems: \"center\",\n\tflexDirection: \"row\",\n\trender: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", { type: \"button\" })\n});\nvar SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, function SelectTrigger2(props, forwardedRef) {\n\tvar _context_floatingContext;\n\tvar { scope, disabled = false, ...triggerProps } = props;\n\tvar context = (0, import_context.useSelectContext)(scope);\n\tvar itemParentContext = (0, import_context.useSelectItemParentContext)(scope);\n\tvar composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);\n\tvar pressIsTouch = React.useRef(false);\n\tif (itemParentContext.shouldRenderWebNative) return null;\n\tvar toggleOpen = function(event) {\n\t\tvar reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"trigger-press\";\n\t\tif (!disabled) itemParentContext.requestOpenChange(!context.open, (0, import_core.createChangeEventDetails)(reason, (event === null || event === void 0 ? void 0 : event.nativeEvent) || event, event === null || event === void 0 ? void 0 : event.currentTarget));\n\t};\n\tvar interactionProps = {\n\t\t...triggerProps,\n\t\t...import_constants.isWeb ? {\n\t\t\tonMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {\n\t\t\t\tpressIsTouch.current = event.type === \"touchstart\";\n\t\t\t\tif (pressIsTouch.current) return;\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleOpen(event);\n\t\t\t}),\n\t\t\tonPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, function(event) {\n\t\t\t\tif (!pressIsTouch.current) return;\n\t\t\t\tpressIsTouch.current = false;\n\t\t\t\ttoggleOpen(event);\n\t\t\t})\n\t\t} : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },\n\t\tonKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, function(event) {\n\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleOpen(event, \"keyboard\");\n\t\t\t}\n\t\t})\n\t};\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTriggerFrame, {\n\t\ttype: \"button\",\n\t\tid: itemParentContext.id,\n\t\trole: \"combobox\",\n\t\t\"aria-haspopup\": \"listbox\",\n\t\t\"aria-expanded\": context.open,\n\t\t\"aria-autocomplete\": \"none\",\n\t\taccessibilityRole: import_constants.isWeb ? void 0 : \"button\",\n\t\taccessibilityState: import_constants.isWeb ? void 0 : {\n\t\t\texpanded: context.open,\n\t\t\tdisabled\n\t\t},\n\t\tdir: context.dir,\n\t\tdisabled,\n\t\t\"data-disabled\": disabled ? \"\" : void 0,\n\t\t...interactionProps,\n\t\tref: composedRefs\n\t});\n});\n//# sourceMappingURL=SelectTrigger.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC/B,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;AACF;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC7C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EACnE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QAAQ,UAAU,IAAI,KAAK;GAC9G,WAAW,KAAK;GAChB,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAC3D,CAAC;CACF;CACA,OAAO;AACR;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKpG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CACpE,OAAO;CACP,YAAY;AACb,CAAC,IAAI,QACL,GACD;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB;CAC/B,qBAAqB;CACrB,0BAA0B;AAC3B,CAAC;AACD,OAAO,UAAU,aAAa,qBAAqB;AACnD,IAAI,qBAAqB,QAAQ,m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GAAG,iBAAiB,QAAQ;GAC3B,cAAc,GAAG,eAAe,qBAAoB,CAAE,aAAa,aAAa,SAAS,OAAO;IAC/F,aAAa,UAAU,MAAM,SAAS;IACtC,IAAI,aAAa,SAAS;IAC1B,MAAM,eAAe;IACrB,WAAW,KAAK;GACjB,CAAC;GACD,UAAU,GAAG,eAAe,qBAAoB,CAAE,aAAa,SAAS,SAAS,OAAO;IACvF,IAAI,CAAC,aAAa,SAAS;IAC3B,aAAa,UAAU;IACvB,WAAW,KAAK;GACjB,CAAC;EACF,IAAI,EAAE,UAAU,GAAG,eAAe,qBAAoB,CAAE,aAAa,SAAS,UAAU,EAAE;EAC1F,YAAY,GAAG,eAAe,qBAAoB,CAAE,aAAa,WAAW,SAAS,OAAO;GAC3F,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;IAC/C,MAAM,eAAe;IACrB,WAAW,OAAO,UAAU;GAC7B;EACD,CAAC;CACF;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB;EACtE,MAAM;EACN,IAAI,kBAAkB;EACtB,MAAM;EACN,iBAAiB;EACjB,iBAAiB,QAAQ;EACzB,qBAAqB;EACrB,mBAAmB,iBAAiB,QAAQ,KAAK,IAAI;EACrD,oBAAoB,iBAAiB,QAAQ,KAAK,IAAI;GACrD,UAAU,QAAQ;GAClB;EACD;EACA,KAAK,QAAQ;EACb;EACA,iBAAiB,WAAW,KAAK,KAAK;EACtC,GAAG;EACH,KAAK;CACN,CAAC;AACF,CAAC"}
@@ -37,7 +37,6 @@ var import_constants = require("@tamagui/constants");
37
37
  var import_core = require("@tamagui/core");
38
38
  var import_portal = require("@tamagui/portal");
39
39
  var import_stacks = require("@tamagui/stacks");
40
- var import_start_transition = require("@tamagui/start-transition");
41
40
  var React = __toESM(require("react"), 1);
42
41
  var import_constants2 = require("./constants.cjs");
43
42
  var import_context = require("./context.cjs");
@@ -55,19 +54,9 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
55
54
  const isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
56
55
  const viewportRef = React.useRef(null);
57
56
  const registeredItemCount = itemContext.registry.getItems().length;
58
- const [lazyMounted, setLazyMounted] = React.useState(context.lazyMount ? false : true);
59
- React.useEffect(() => {
60
- if (!context.lazyMount) return;
61
- if (!context.open) return;
62
- if (lazyMounted) return;
63
- (0, import_start_transition.startTransition)(() => {
64
- setLazyMounted(true);
65
- });
66
- }, [
67
- context.lazyMount,
68
- context.open,
69
- lazyMounted
70
- ]);
57
+ const hasOpenedRef = React.useRef(!context.lazyMount);
58
+ if (context.open) hasOpenedRef.current = true;
59
+ const lazyMounted = hasOpenedRef.current;
71
60
  React.useEffect(() => {
72
61
  if (!import_constants.isWeb || !isAdapted || !context.open) return;
73
62
  const frame = requestAnimationFrame(() => {
@@ -77,7 +66,6 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
77
66
  });
78
67
  return () => cancelAnimationFrame(frame);
79
68
  }, [
80
- context.activeIndex,
81
69
  context.open,
82
70
  isAdapted,
83
71
  registeredItemCount
@@ -89,11 +77,11 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
89
77
  }
90
78
  }, [isAdapted]);
91
79
  React.useEffect(() => {
92
- if (context.lazyMount && lazyMounted && context.open && context.update) {
80
+ if (context.lazyMount && context.open && context.update) {
93
81
  const frame = requestAnimationFrame(context.update);
94
82
  return () => cancelAnimationFrame(frame);
95
83
  }
96
- }, [lazyMounted, registeredItemCount]);
84
+ }, [context.open, registeredItemCount]);
97
85
  if (itemContext.shouldRenderWebNative) {
98
86
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {
99
87
  position: "relative",
@@ -120,23 +108,27 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
120
108
  children: content
121
109
  });
122
110
  }
123
- if (!itemContext.interactions) {
111
+ if (!context.interactions) {
124
112
  return null;
125
113
  }
126
- const { style, className, ...floatingProps } = itemContext.interactions.getFloatingProps();
114
+ const floatingProps = context.interactions.getFloatingProps();
127
115
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
128
116
  !disableScroll && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { dangerouslySetInnerHTML: { __html: selectViewportCSS } }),
129
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, { children: context.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
130
- "data-select-viewport": "",
131
- ...import_constants.isWeb && { "data-state": context.open ? "open" : "closed" },
132
- ...viewportProps,
133
- ...style,
134
- ...floatingProps,
135
- ...(0, import_selectionController.getSelectListboxProps)(itemContext.mode),
136
- overflowY: disableScroll ? void 0 : style.overflow ?? "auto",
137
- ref: composedRefs,
138
- children: lazyMounted ? children : null
139
- }, "select-viewport") : null }),
117
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
118
+ presenceAffectsLayout: false,
119
+ children: context.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
120
+ "data-select-viewport": "",
121
+ ...import_constants.isWeb && { "data-state": context.open ? "open" : "closed" },
122
+ ...viewportProps,
123
+ ...context.floatingPosition,
124
+ outlineWidth: 0,
125
+ ...floatingProps,
126
+ ...(0, import_selectionController.getSelectListboxProps)(itemContext.mode),
127
+ overflowY: disableScroll ? void 0 : "auto",
128
+ ref: composedRefs,
129
+ children: lazyMounted ? children : null
130
+ }, "select-viewport") : null
131
+ }),
140
132
  !context.open && !(context.lazyMount && context.renderValue) && lazyMounted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
141
133
  style: { display: "none" },
142
134
  children