@tamagui/select 2.7.7 → 3.0.0-beta.1091.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 (248) hide show
  1. package/dist/cjs/Select.cjs +406 -467
  2. package/dist/cjs/Select.native.cjs +495 -0
  3. package/dist/cjs/Select.native.js +445 -492
  4. package/dist/cjs/Select.native.js.map +1 -1
  5. package/dist/cjs/SelectContent.cjs +79 -79
  6. package/dist/cjs/SelectContent.native.cjs +29 -0
  7. package/dist/cjs/SelectContent.native.js +17 -22
  8. package/dist/cjs/SelectContent.native.js.map +1 -1
  9. package/dist/cjs/SelectImpl.cjs +305 -320
  10. package/dist/cjs/SelectImpl.native.cjs +29 -0
  11. package/dist/cjs/SelectImpl.native.js +16 -24
  12. package/dist/cjs/SelectImpl.native.js.map +1 -1
  13. package/dist/cjs/SelectItem.cjs +256 -205
  14. package/dist/cjs/SelectItem.native.cjs +288 -0
  15. package/dist/cjs/SelectItem.native.js +264 -213
  16. package/dist/cjs/SelectItem.native.js.map +1 -1
  17. package/dist/cjs/SelectItemText.cjs +48 -79
  18. package/dist/cjs/SelectItemText.native.cjs +73 -0
  19. package/dist/cjs/SelectItemText.native.js +49 -79
  20. package/dist/cjs/SelectItemText.native.js.map +1 -1
  21. package/dist/cjs/SelectScrollButton.cjs +110 -130
  22. package/dist/cjs/SelectScrollButton.native.cjs +37 -0
  23. package/dist/cjs/SelectScrollButton.native.js +24 -22
  24. package/dist/cjs/SelectScrollButton.native.js.map +1 -1
  25. package/dist/cjs/SelectTrigger.cjs +68 -84
  26. package/dist/cjs/SelectTrigger.native.cjs +90 -0
  27. package/dist/cjs/SelectTrigger.native.js +70 -66
  28. package/dist/cjs/SelectTrigger.native.js.map +1 -1
  29. package/dist/cjs/SelectViewport.cjs +121 -142
  30. package/dist/cjs/SelectViewport.native.cjs +72 -0
  31. package/dist/cjs/SelectViewport.native.js +53 -50
  32. package/dist/cjs/SelectViewport.native.js.map +1 -1
  33. package/dist/cjs/constants.cjs +20 -22
  34. package/dist/cjs/constants.native.cjs +40 -0
  35. package/dist/cjs/constants.native.js +20 -21
  36. package/dist/cjs/constants.native.js.map +1 -1
  37. package/dist/cjs/context.cjs +37 -48
  38. package/dist/cjs/context.native.cjs +57 -0
  39. package/dist/cjs/context.native.js +39 -49
  40. package/dist/cjs/context.native.js.map +1 -1
  41. package/dist/cjs/index.cjs +14 -11
  42. package/dist/cjs/index.native.cjs +26 -0
  43. package/dist/cjs/index.native.js +14 -10
  44. package/dist/cjs/index.native.js.map +1 -1
  45. package/dist/cjs/selectionController.cjs +343 -0
  46. package/dist/cjs/selectionController.native.cjs +407 -0
  47. package/dist/cjs/selectionController.native.js +409 -0
  48. package/dist/cjs/selectionController.native.js.map +1 -0
  49. package/dist/cjs/types.cjs +9 -11
  50. package/dist/cjs/types.native.cjs +18 -0
  51. package/dist/cjs/types.native.js +9 -10
  52. package/dist/cjs/types.native.js.map +1 -1
  53. package/dist/esm/Select.mjs +381 -443
  54. package/dist/esm/Select.mjs.map +1 -1
  55. package/dist/esm/Select.native.js +420 -469
  56. package/dist/esm/Select.native.js.map +1 -1
  57. package/dist/esm/SelectContent.mjs +67 -61
  58. package/dist/esm/SelectContent.mjs.map +1 -1
  59. package/dist/esm/SelectContent.native.js +4 -5
  60. package/dist/esm/SelectContent.native.js.map +1 -1
  61. package/dist/esm/SelectImpl.mjs +291 -295
  62. package/dist/esm/SelectImpl.mjs.map +1 -1
  63. package/dist/esm/SelectImpl.native.js +5 -8
  64. package/dist/esm/SelectImpl.native.js.map +1 -1
  65. package/dist/esm/SelectItem.mjs +240 -181
  66. package/dist/esm/SelectItem.mjs.map +1 -1
  67. package/dist/esm/SelectItem.native.js +249 -191
  68. package/dist/esm/SelectItem.native.js.map +1 -1
  69. package/dist/esm/SelectItemText.mjs +33 -55
  70. package/dist/esm/SelectItemText.mjs.map +1 -1
  71. package/dist/esm/SelectItemText.native.js +34 -56
  72. package/dist/esm/SelectItemText.native.js.map +1 -1
  73. package/dist/esm/SelectScrollButton.mjs +95 -107
  74. package/dist/esm/SelectScrollButton.mjs.map +1 -1
  75. package/dist/esm/SelectScrollButton.native.js +11 -7
  76. package/dist/esm/SelectScrollButton.native.js.map +1 -1
  77. package/dist/esm/SelectTrigger.mjs +56 -58
  78. package/dist/esm/SelectTrigger.mjs.map +1 -1
  79. package/dist/esm/SelectTrigger.native.js +54 -44
  80. package/dist/esm/SelectTrigger.native.js.map +1 -1
  81. package/dist/esm/SelectViewport.mjs +107 -119
  82. package/dist/esm/SelectViewport.mjs.map +1 -1
  83. package/dist/esm/SelectViewport.native.js +44 -39
  84. package/dist/esm/SelectViewport.native.js.map +1 -1
  85. package/dist/esm/constants.mjs +1 -0
  86. package/dist/esm/constants.mjs.map +1 -1
  87. package/dist/esm/constants.native.js +1 -0
  88. package/dist/esm/constants.native.js.map +1 -1
  89. package/dist/esm/context.mjs +20 -28
  90. package/dist/esm/context.mjs.map +1 -1
  91. package/dist/esm/context.native.js +23 -31
  92. package/dist/esm/context.native.js.map +1 -1
  93. package/dist/esm/index.js +13 -3
  94. package/dist/esm/index.mjs +13 -3
  95. package/dist/esm/index.native.js +13 -3
  96. package/dist/esm/selectionController.mjs +315 -0
  97. package/dist/esm/selectionController.mjs.map +1 -0
  98. package/dist/esm/selectionController.native.js +377 -0
  99. package/dist/esm/selectionController.native.js.map +1 -0
  100. package/dist/esm/types.mjs +0 -2
  101. package/dist/esm/types.native.js +0 -2
  102. package/dist/jsx/Select.mjs +381 -443
  103. package/dist/jsx/Select.mjs.map +1 -1
  104. package/dist/jsx/Select.native.cjs +495 -0
  105. package/dist/jsx/Select.native.js +445 -492
  106. package/dist/jsx/Select.native.js.map +1 -1
  107. package/dist/jsx/SelectContent.mjs +67 -61
  108. package/dist/jsx/SelectContent.mjs.map +1 -1
  109. package/dist/jsx/SelectContent.native.cjs +29 -0
  110. package/dist/jsx/SelectContent.native.js +17 -22
  111. package/dist/jsx/SelectContent.native.js.map +1 -1
  112. package/dist/jsx/SelectImpl.mjs +291 -295
  113. package/dist/jsx/SelectImpl.mjs.map +1 -1
  114. package/dist/jsx/SelectImpl.native.cjs +29 -0
  115. package/dist/jsx/SelectImpl.native.js +16 -24
  116. package/dist/jsx/SelectImpl.native.js.map +1 -1
  117. package/dist/jsx/SelectItem.mjs +240 -181
  118. package/dist/jsx/SelectItem.mjs.map +1 -1
  119. package/dist/jsx/SelectItem.native.cjs +288 -0
  120. package/dist/jsx/SelectItem.native.js +264 -213
  121. package/dist/jsx/SelectItem.native.js.map +1 -1
  122. package/dist/jsx/SelectItemText.mjs +33 -55
  123. package/dist/jsx/SelectItemText.mjs.map +1 -1
  124. package/dist/jsx/SelectItemText.native.cjs +73 -0
  125. package/dist/jsx/SelectItemText.native.js +49 -79
  126. package/dist/jsx/SelectItemText.native.js.map +1 -1
  127. package/dist/jsx/SelectScrollButton.mjs +95 -107
  128. package/dist/jsx/SelectScrollButton.mjs.map +1 -1
  129. package/dist/jsx/SelectScrollButton.native.cjs +37 -0
  130. package/dist/jsx/SelectScrollButton.native.js +24 -22
  131. package/dist/jsx/SelectScrollButton.native.js.map +1 -1
  132. package/dist/jsx/SelectTrigger.mjs +56 -58
  133. package/dist/jsx/SelectTrigger.mjs.map +1 -1
  134. package/dist/jsx/SelectTrigger.native.cjs +90 -0
  135. package/dist/jsx/SelectTrigger.native.js +70 -66
  136. package/dist/jsx/SelectTrigger.native.js.map +1 -1
  137. package/dist/jsx/SelectViewport.mjs +107 -119
  138. package/dist/jsx/SelectViewport.mjs.map +1 -1
  139. package/dist/jsx/SelectViewport.native.cjs +72 -0
  140. package/dist/jsx/SelectViewport.native.js +53 -50
  141. package/dist/jsx/SelectViewport.native.js.map +1 -1
  142. package/dist/jsx/constants.mjs +1 -0
  143. package/dist/jsx/constants.mjs.map +1 -1
  144. package/dist/jsx/constants.native.cjs +40 -0
  145. package/dist/jsx/constants.native.js +20 -21
  146. package/dist/jsx/constants.native.js.map +1 -1
  147. package/dist/jsx/context.mjs +20 -28
  148. package/dist/jsx/context.mjs.map +1 -1
  149. package/dist/jsx/context.native.cjs +57 -0
  150. package/dist/jsx/context.native.js +39 -49
  151. package/dist/jsx/context.native.js.map +1 -1
  152. package/dist/jsx/index.js +13 -3
  153. package/dist/jsx/index.mjs +13 -3
  154. package/dist/jsx/index.native.cjs +26 -0
  155. package/dist/jsx/index.native.js +14 -10
  156. package/dist/jsx/index.native.js.map +1 -1
  157. package/dist/jsx/selectionController.mjs +315 -0
  158. package/dist/jsx/selectionController.mjs.map +1 -0
  159. package/dist/jsx/selectionController.native.cjs +407 -0
  160. package/dist/jsx/selectionController.native.js +409 -0
  161. package/dist/jsx/selectionController.native.js.map +1 -0
  162. package/dist/jsx/types.mjs +0 -2
  163. package/dist/jsx/types.native.cjs +18 -0
  164. package/dist/jsx/types.native.js +9 -10
  165. package/dist/jsx/types.native.js.map +1 -1
  166. package/package.json +31 -30
  167. package/src/Select.tsx +478 -378
  168. package/src/SelectContent.tsx +46 -16
  169. package/src/SelectImpl.native.tsx +0 -8
  170. package/src/SelectImpl.tsx +149 -160
  171. package/src/SelectItem.tsx +280 -159
  172. package/src/SelectItemText.tsx +16 -33
  173. package/src/SelectScrollButton.native.tsx +13 -4
  174. package/src/SelectScrollButton.tsx +57 -42
  175. package/src/SelectTrigger.tsx +77 -53
  176. package/src/SelectViewport.native.tsx +42 -25
  177. package/src/SelectViewport.tsx +60 -60
  178. package/src/context.tsx +6 -2
  179. package/src/index.tsx +5 -2
  180. package/src/selectionController.ts +404 -0
  181. package/src/types.tsx +105 -59
  182. package/types/Select.d.ts +139 -201
  183. package/types/Select.d.ts.map +1 -1
  184. package/types/SelectContent.d.ts +1 -1
  185. package/types/SelectContent.d.ts.map +1 -1
  186. package/types/SelectContent.native.d.ts.map +1 -1
  187. package/types/SelectImpl.d.ts +2 -1
  188. package/types/SelectImpl.d.ts.map +1 -1
  189. package/types/SelectImpl.native.d.ts +1 -5
  190. package/types/SelectImpl.native.d.ts.map +1 -1
  191. package/types/SelectItem.d.ts +13 -16
  192. package/types/SelectItem.d.ts.map +1 -1
  193. package/types/SelectItemText.d.ts +9 -13
  194. package/types/SelectItemText.d.ts.map +1 -1
  195. package/types/SelectScrollButton.d.ts +15 -2
  196. package/types/SelectScrollButton.d.ts.map +1 -1
  197. package/types/SelectScrollButton.native.d.ts +16 -3
  198. package/types/SelectScrollButton.native.d.ts.map +1 -1
  199. package/types/SelectTrigger.d.ts +11 -23
  200. package/types/SelectTrigger.d.ts.map +1 -1
  201. package/types/SelectViewport.d.ts +11 -38
  202. package/types/SelectViewport.d.ts.map +1 -1
  203. package/types/SelectViewport.native.d.ts +15 -4
  204. package/types/SelectViewport.native.d.ts.map +1 -1
  205. package/types/context.d.ts +2 -0
  206. package/types/context.d.ts.map +1 -1
  207. package/types/index.d.ts +5 -2
  208. package/types/index.d.ts.map +1 -1
  209. package/types/selectionController.d.ts +90 -0
  210. package/types/selectionController.d.ts.map +1 -0
  211. package/types/types.d.ts +66 -50
  212. package/types/types.d.ts.map +1 -1
  213. package/dist/cjs/BubbleSelect.cjs +0 -50
  214. package/dist/cjs/BubbleSelect.native.js +0 -30
  215. package/dist/cjs/BubbleSelect.native.js.map +0 -1
  216. package/dist/cjs/useSelectBreakpointActive.cjs +0 -32
  217. package/dist/cjs/useSelectBreakpointActive.native.js +0 -35
  218. package/dist/cjs/useSelectBreakpointActive.native.js.map +0 -1
  219. package/dist/esm/BubbleSelect.mjs +0 -27
  220. package/dist/esm/BubbleSelect.mjs.map +0 -1
  221. package/dist/esm/BubbleSelect.native.js +0 -4
  222. package/dist/esm/BubbleSelect.native.js.map +0 -1
  223. package/dist/esm/index.js.map +0 -1
  224. package/dist/esm/index.mjs.map +0 -1
  225. package/dist/esm/index.native.js.map +0 -1
  226. package/dist/esm/types.mjs.map +0 -1
  227. package/dist/esm/types.native.js.map +0 -1
  228. package/dist/esm/useSelectBreakpointActive.mjs +0 -7
  229. package/dist/esm/useSelectBreakpointActive.mjs.map +0 -1
  230. package/dist/esm/useSelectBreakpointActive.native.js +0 -7
  231. package/dist/esm/useSelectBreakpointActive.native.js.map +0 -1
  232. package/dist/jsx/BubbleSelect.mjs +0 -27
  233. package/dist/jsx/BubbleSelect.mjs.map +0 -1
  234. package/dist/jsx/BubbleSelect.native.js +0 -30
  235. package/dist/jsx/BubbleSelect.native.js.map +0 -1
  236. package/dist/jsx/index.js.map +0 -1
  237. package/dist/jsx/index.mjs.map +0 -1
  238. package/dist/jsx/types.mjs.map +0 -1
  239. package/dist/jsx/useSelectBreakpointActive.mjs +0 -7
  240. package/dist/jsx/useSelectBreakpointActive.mjs.map +0 -1
  241. package/dist/jsx/useSelectBreakpointActive.native.js +0 -35
  242. package/dist/jsx/useSelectBreakpointActive.native.js.map +0 -1
  243. package/src/BubbleSelect.tsx +0 -50
  244. package/src/useSelectBreakpointActive.tsx +0 -7
  245. package/types/BubbleSelect.d.ts +0 -2
  246. package/types/BubbleSelect.d.ts.map +0 -1
  247. package/types/useSelectBreakpointActive.d.ts +0 -3
  248. package/types/useSelectBreakpointActive.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["autoUpdate","inner","offset","size","useClick","useFloatingRaw","useInnerOffset","useInteractions","useListNavigation","useRole","useTypeahead","useIsomorphicLayoutEffect","useEvent","useIsTouchDevice","React","flushSync","SCROLL_ARROW_THRESHOLD","SelectItemParentProvider","SelectProvider","useSelectContext","useSelectItemParentContext","jsx","SelectInlineImpl","props","scope","children","open","listContentRef","setActiveIndexFast","selectContext","selectItemParentContext","setActiveIndex","selectedIndex","activeIndexRef","setOpen","setSelectedIndex","scrollTop","setScrollTop","useState","touch","listItemsRef","useRef","overflowRef","upArrowRef","downArrowRef","allowSelectRef","allowMouseUpRef","selectTimeoutRef","state","isMouseOutside","isTyping","controlledScrolling","setControlledScrolling","fallback","setFallback","innerOffset","setInnerOffset","blockSelection","setBlockSelection","floatingStyle","useEffect","mouseUp","e","current","document","addEventListener","removeEventListener","x","y","strategy","refs","update","placement","computedPlacement","whileElementsMounted","middleware","apply","rects","reference","width","Object","assign","minWidth","floating","style","listRef","index","onFallbackChange","padding","minItemsVisible","referenceOverflowThreshold","crossAxis","floatingRef","showUpArrow","showDownArrow","scrollHeight","clientHeight","isScrollable","window","onMatch","dataRef","interactionContext","onOpenChange","val","domReference","elements","interactionsProps","event","keyboardHandlers","role","enabled","onChange","scrollRef","activeIndex","onNavigate","scrollItemIntoView","onTypingChange","interactions","useMemo","interactionsContext","getReferenceProps","ref","className","onKeyDown","key","code","preventDefault","getFloatingProps","props2","position","top","left","outline","scrollbarWidth","onPointerEnter","onPointerLeave","onPointerMove","onContextMenu","onScroll","currentTarget","setTimeout","clearTimeout","onPointerDown","target","contains","scrollActiveIntoView","scrollIntoView","block","activeIndexSubscribe","maxHeight","floatingContext","canScrollDown","canScrollUp"],"sources":["SelectImpl.mjs"],"sourcesContent":["import { autoUpdate, inner, offset, size, useClick, useFloatingRaw, useInnerOffset, useInteractions, useListNavigation, useRole, useTypeahead } from \"@tamagui/floating\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { useEvent, useIsTouchDevice } from \"@tamagui/core\";\nimport * as React from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { SCROLL_ARROW_THRESHOLD } from \"./constants\";\nimport { SelectItemParentProvider, SelectProvider, useSelectContext, useSelectItemParentContext } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst SelectInlineImpl = (props) => {\n\tconst { scope, children, open = false, listContentRef, setActiveIndexFast } = props;\n\tconst selectContext = useSelectContext(scope);\n\tconst selectItemParentContext = useSelectItemParentContext(scope);\n\tconst { setActiveIndex, selectedIndex, activeIndexRef } = selectContext;\n\tconst { setOpen, setSelectedIndex } = selectItemParentContext;\n\tconst [scrollTop, setScrollTop] = React.useState(0);\n\tconst touch = useIsTouchDevice();\n\tconst listItemsRef = React.useRef([]);\n\tconst overflowRef = React.useRef(null);\n\tconst upArrowRef = React.useRef(null);\n\tconst downArrowRef = React.useRef(null);\n\tconst allowSelectRef = React.useRef(false);\n\tconst allowMouseUpRef = React.useRef(true);\n\tconst selectTimeoutRef = React.useRef(null);\n\tconst state = React.useRef({\n\t\tisMouseOutside: false,\n\t\tisTyping: false\n\t});\n\tconst [controlledScrolling, setControlledScrolling] = React.useState(false);\n\tconst [fallback, setFallback] = React.useState(false);\n\tconst [innerOffset, setInnerOffset] = React.useState(0);\n\tconst [blockSelection, setBlockSelection] = React.useState(false);\n\tconst floatingStyle = React.useRef({});\n\tReact.useEffect(() => {\n\t\tif (open) setActiveIndexFast(selectedIndex ?? 0);\n\t\telse {\n\t\t\tsetScrollTop(0);\n\t\t\tsetFallback(false);\n\t\t\tsetActiveIndexFast(null);\n\t\t\tsetControlledScrolling(false);\n\t\t}\n\t}, [\n\t\topen,\n\t\tselectedIndex,\n\t\tsetActiveIndexFast\n\t]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!open) return;\n\t\tconst mouseUp = (e) => {\n\t\t\tif (state.current.isMouseOutside) setOpen(false);\n\t\t};\n\t\tdocument.addEventListener(\"mouseup\", mouseUp);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"mouseup\", mouseUp);\n\t\t};\n\t}, [open]);\n\tconst { x, y, strategy, refs, update, placement: computedPlacement } = useFloatingRaw({\n\t\topen,\n\t\tplacement: \"bottom-start\",\n\t\twhileElementsMounted: autoUpdate,\n\t\tmiddleware: [\n\t\t\tsize({ apply({ rects: { reference: { width } } }) {\n\t\t\t\tObject.assign(floatingStyle.current, { minWidth: width + 8 });\n\t\t\t\tif (refs.floating.current) Object.assign(refs.floating.current.style, floatingStyle.current);\n\t\t\t} }),\n\t\t\tinner({\n\t\t\t\tlistRef: listItemsRef,\n\t\t\t\toverflowRef,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\toffset: innerOffset,\n\t\t\t\tonFallbackChange: setFallback,\n\t\t\t\tpadding: 10,\n\t\t\t\tminItemsVisible: touch ? 10 : 4,\n\t\t\t\treferenceOverflowThreshold: 20\n\t\t\t}),\n\t\t\toffset({ crossAxis: -5 })\n\t\t]\n\t});\n\tconst floatingRef = refs.floating;\n\tconst showUpArrow = open && scrollTop > SCROLL_ARROW_THRESHOLD;\n\tconst showDownArrow = open && floatingRef.current && scrollTop < floatingRef.current.scrollHeight - floatingRef.current.clientHeight - SCROLL_ARROW_THRESHOLD;\n\tconst isScrollable = showDownArrow || showUpArrow;\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (typeof window === \"undefined\") return;\n\t\twindow.addEventListener(\"resize\", update);\n\t\tif (open) update();\n\t\treturn () => window.removeEventListener(\"resize\", update);\n\t}, [update, open]);\n\tconst onMatch = useEvent((index) => {\n\t\treturn (open ? setActiveIndex : setSelectedIndex)(index);\n\t});\n\tconst dataRef = React.useRef({});\n\tdataRef.current.placement = computedPlacement;\n\tconst interactionContext = {\n\t\topen,\n\t\tonOpenChange: (val) => setOpen(val),\n\t\trefs: {\n\t\t\treference: refs.reference,\n\t\t\tfloating: refs.floating,\n\t\t\tdomReference: refs.reference\n\t\t},\n\t\telements: {\n\t\t\treference: refs.reference?.current || null,\n\t\t\tfloating: refs.floating?.current || null,\n\t\t\tdomReference: refs.reference?.current || null\n\t\t},\n\t\tdataRef\n\t};\n\tconst interactionsProps = [\n\t\tuseClick(interactionContext, {\n\t\t\tevent: \"mousedown\",\n\t\t\tkeyboardHandlers: false\n\t\t}),\n\t\tuseRole(interactionContext, { role: \"listbox\" }),\n\t\tuseInnerOffset(interactionContext, {\n\t\t\tenabled: !fallback && isScrollable,\n\t\t\tonChange: setInnerOffset,\n\t\t\toverflowRef,\n\t\t\tscrollRef: refs.floating\n\t\t}),\n\t\tuseListNavigation(interactionContext, {\n\t\t\tlistRef: listItemsRef,\n\t\t\tactiveIndex: selectContext.activeIndex ?? 0,\n\t\t\tselectedIndex,\n\t\t\tonNavigate: (index) => {\n\t\t\t\tif (index !== null) setActiveIndex(index);\n\t\t\t},\n\t\t\tscrollItemIntoView: false\n\t\t}),\n\t\tuseTypeahead(interactionContext, {\n\t\t\tlistRef: listContentRef,\n\t\t\tonMatch,\n\t\t\tselectedIndex,\n\t\t\tactiveIndex: selectContext.activeIndex,\n\t\t\tonTypingChange: (e) => {\n\t\t\t\tstate.current.isTyping = e;\n\t\t\t}\n\t\t})\n\t];\n\tconst interactions = useInteractions(React.useMemo(() => {\n\t\treturn interactionsProps;\n\t}, interactionsProps));\n\tconst interactionsContext = React.useMemo(() => {\n\t\treturn {\n\t\t\t...interactions,\n\t\t\tgetReferenceProps() {\n\t\t\t\treturn interactions.getReferenceProps({\n\t\t\t\t\tref: refs.reference,\n\t\t\t\t\tclassName: \"SelectTrigger\",\n\t\t\t\t\tonKeyDown(event) {\n\t\t\t\t\t\tif (event.key === \"Enter\" || event.code === \"Space\" || event.key === \" \" && !state.current.isTyping) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetOpen(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\tgetFloatingProps(props2) {\n\t\t\t\treturn interactions.getFloatingProps({\n\t\t\t\t\tref: refs.floating,\n\t\t\t\t\tclassName: \"Select\",\n\t\t\t\t\t...props2,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tposition: strategy,\n\t\t\t\t\t\ttop: y ?? \"\",\n\t\t\t\t\t\tleft: x ?? \"\",\n\t\t\t\t\t\toutline: 0,\n\t\t\t\t\t\tscrollbarWidth: \"none\",\n\t\t\t\t\t\t...floatingStyle.current,\n\t\t\t\t\t\t...props2?.style\n\t\t\t\t\t},\n\t\t\t\t\tonPointerEnter() {\n\t\t\t\t\t\tsetControlledScrolling(false);\n\t\t\t\t\t\tstate.current.isMouseOutside = false;\n\t\t\t\t\t},\n\t\t\t\t\tonPointerLeave() {\n\t\t\t\t\t\tstate.current.isMouseOutside = true;\n\t\t\t\t\t},\n\t\t\t\t\tonPointerMove() {\n\t\t\t\t\t\tstate.current.isMouseOutside = false;\n\t\t\t\t\t\tsetControlledScrolling(false);\n\t\t\t\t\t},\n\t\t\t\t\tonKeyDown() {\n\t\t\t\t\t\tsetControlledScrolling(true);\n\t\t\t\t\t},\n\t\t\t\t\tonContextMenu(e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t},\n\t\t\t\t\tonScroll(event) {\n\t\t\t\t\t\tflushSync(() => {\n\t\t\t\t\t\t\tsetScrollTop(event.currentTarget.scrollTop);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}, [\n\t\trefs.reference.current,\n\t\tx,\n\t\ty,\n\t\trefs.floating.current,\n\t\tinteractions\n\t]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (open) {\n\t\t\tallowMouseUpRef.current = false;\n\t\t\tselectTimeoutRef.current = setTimeout(() => {\n\t\t\t\tallowSelectRef.current = true;\n\t\t\t\tallowMouseUpRef.current = true;\n\t\t\t}, 300);\n\t\t\treturn () => {\n\t\t\t\tclearTimeout(selectTimeoutRef.current);\n\t\t\t};\n\t\t}\n\t\tallowSelectRef.current = false;\n\t\tallowMouseUpRef.current = true;\n\t\tsetInnerOffset(0);\n\t\tsetFallback(false);\n\t\tsetBlockSelection(false);\n\t}, [open]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!open && state.current.isMouseOutside) state.current.isMouseOutside = false;\n\t}, [open]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tfunction onPointerDown(e) {\n\t\t\tconst target = e.target;\n\t\t\tif (!(refs.floating.current?.contains(target) || upArrowRef.current?.contains(target) || downArrowRef.current?.contains(target))) {\n\t\t\t\tsetOpen(false);\n\t\t\t\tsetControlledScrolling(false);\n\t\t\t}\n\t\t}\n\t\tif (open) {\n\t\t\tdocument.addEventListener(\"pointerdown\", onPointerDown);\n\t\t\treturn () => {\n\t\t\t\tdocument.removeEventListener(\"pointerdown\", onPointerDown);\n\t\t\t};\n\t\t}\n\t}, [\n\t\topen,\n\t\trefs,\n\t\tsetOpen\n\t]);\n\tReact.useEffect(() => {\n\t\tif (!open) return;\n\t\tconst scrollActiveIntoView = (index) => {\n\t\t\tif (controlledScrolling && index != null) listItemsRef.current[index]?.scrollIntoView({ block: \"nearest\" });\n\t\t\tsetScrollTop(refs.floating.current?.scrollTop ?? 0);\n\t\t};\n\t\tscrollActiveIntoView(activeIndexRef.current);\n\t\treturn selectItemParentContext.activeIndexSubscribe(scrollActiveIntoView);\n\t}, [\n\t\topen,\n\t\trefs,\n\t\tcontrolledScrolling,\n\t\tselectItemParentContext.activeIndexSubscribe\n\t]);\n\tReact.useEffect(() => {\n\t\tif (open && fallback) {\n\t\t\tif (selectedIndex != null) listItemsRef.current[selectedIndex]?.scrollIntoView({ block: \"nearest\" });\n\t\t}\n\t}, [\n\t\topen,\n\t\tfallback,\n\t\tselectedIndex\n\t]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (refs.floating.current && fallback) refs.floating.current.style.maxHeight = \"\";\n\t}, [refs, fallback]);\n\tconst floatingContext = React.useMemo(() => ({\n\t\trefs,\n\t\tdataRef\n\t}), [refs]);\n\treturn /* @__PURE__ */ jsx(SelectProvider, {\n\t\tscope,\n\t\t...selectContext,\n\t\tsetScrollTop,\n\t\tsetInnerOffset,\n\t\tfallback,\n\t\tfloatingContext,\n\t\tcanScrollDown: !!showDownArrow,\n\t\tcanScrollUp: !!showUpArrow,\n\t\tcontrolledScrolling,\n\t\tblockSelection,\n\t\tupArrowRef,\n\t\tdownArrowRef,\n\t\tupdate,\n\t\tchildren: /* @__PURE__ */ jsx(SelectItemParentProvider, {\n\t\t\tscope,\n\t\t\t...selectItemParentContext,\n\t\t\tallowMouseUpRef,\n\t\t\tallowSelectRef,\n\t\t\tdataRef,\n\t\t\tinteractions: interactionsContext,\n\t\t\tlistRef: listItemsRef,\n\t\t\tselectTimeoutRef,\n\t\t\tchildren\n\t\t})\n\t});\n};\n\nexport { SelectInlineImpl };"],"mappings":"AAAA,SAASA,UAAU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7C,YAAY;MACrBO,gBAAgB;MAChBtB;IACD,CAAC;EACF,CAAC,CAAC;AACH,CAAC;AAED,SAASH,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"SelectImpl.js","names":[],"sources":["jsx/SelectImpl.js"],"sourcesContent":["import { autoUpdate, inner, offset, size, useClick, useFloatingRaw, useInnerOffset, useInteractions, useListNavigation, useRole, useTypeahead } from \"@tamagui/floating\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createChangeEventDetails, useEvent, useIsTouchDevice } from \"@tamagui/core\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport * as React from \"react\";\nimport { SCROLL_ARROW_THRESHOLD } from \"./constants\";\nimport { SelectItemParentProvider, SelectProvider, useSelectContext, useSelectItemParentContext } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst SelectInlineImpl = (props) => {\n\tconst { scope, children, open = false, listContentRef } = props;\n\tconst selectContext = useSelectContext(scope);\n\tconst selectItemParentContext = useSelectItemParentContext(scope);\n\tconst { setActiveIndex, selectedIndex, activeIndexRef } = selectContext;\n\tconst { requestOpenChange, registry } = selectItemParentContext;\n\tconst touch = useIsTouchDevice();\n\tconst listItemsRef = selectItemParentContext.listRef;\n\tconst overflowRef = React.useRef(null);\n\tconst upArrowRef = React.useRef(null);\n\tconst downArrowRef = React.useRef(null);\n\tconst allowSelectRef = React.useRef(false);\n\tconst allowMouseUpRef = React.useRef(true);\n\tconst selectTimeoutRef = React.useRef(null);\n\tconst latestKeyboardEventRef = React.useRef(void 0);\n\tconst state = React.useRef({\n\t\tisMouseOutside: false,\n\t\tisTyping: false\n\t});\n\tconst [controlledScrolling, setControlledScrolling] = React.useState(false);\n\tconst [fallback, setFallback] = React.useState(false);\n\tconst [innerOffset, setInnerOffset] = React.useState(0);\n\tconst [blockSelection, setBlockSelection] = React.useState(false);\n\tReact.useEffect(() => {\n\t\tif (!open) {\n\t\t\tsetCanScrollUp(false);\n\t\t\tsetCanScrollDown(false);\n\t\t\tsetFallback(false);\n\t\t\tsetControlledScrolling(false);\n\t\t}\n\t}, [open]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!open) return;\n\t\tconst mouseUp = (e) => {\n\t\t\tif (state.current.isMouseOutside) requestOpenChange(false, createChangeEventDetails(\"outside-press\", e));\n\t\t};\n\t\tdocument.addEventListener(\"mouseup\", mouseUp);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"mouseup\", mouseUp);\n\t\t};\n\t}, [open]);\n\tconst { x, y, strategy, refs, update, placement: computedPlacement } = useFloatingRaw({\n\t\topen,\n\t\tplacement: \"bottom-start\",\n\t\twhileElementsMounted: autoUpdate,\n\t\tmiddleware: [\n\t\t\tsize({ apply({ rects, elements }) {\n\t\t\t\telements.floating.style.minWidth = `${rects.reference.width + 8}px`;\n\t\t\t} }),\n\t\t\tinner({\n\t\t\t\tlistRef: listItemsRef,\n\t\t\t\toverflowRef,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\toffset: innerOffset,\n\t\t\t\tonFallbackChange: setFallback,\n\t\t\t\tpadding: 10,\n\t\t\t\tminItemsVisible: touch ? 10 : 4,\n\t\t\t\treferenceOverflowThreshold: 20\n\t\t\t}),\n\t\t\toffset({ crossAxis: -4 })\n\t\t]\n\t});\n\tconst [canScrollUp, setCanScrollUp] = React.useState(false);\n\tconst [canScrollDown, setCanScrollDown] = React.useState(false);\n\tconst updateScrollArrows = React.useCallback(() => {\n\t\tconst el = refs.floating.current;\n\t\tif (!el) return;\n\t\tsetCanScrollUp(el.scrollTop > SCROLL_ARROW_THRESHOLD);\n\t\tsetCanScrollDown(el.scrollTop < el.scrollHeight - el.clientHeight - SCROLL_ARROW_THRESHOLD);\n\t}, [refs]);\n\tconst showUpArrow = open && canScrollUp;\n\tconst showDownArrow = open && canScrollDown;\n\tconst isScrollable = showDownArrow || showUpArrow;\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (open) update();\n\t}, [update, open]);\n\tconst onMatch = useEvent((index) => {\n\t\tif (!open) return;\n\t\tsetActiveIndex(index, {\n\t\t\treason: \"keyboard\",\n\t\t\tevent: latestKeyboardEventRef.current,\n\t\t\ttrigger: void 0,\n\t\t\tindex\n\t\t});\n\t});\n\tconst dataRef = React.useRef({});\n\tdataRef.current.placement = computedPlacement;\n\tconst onOpenChange = useEvent((nextOpen, event, reason) => {\n\t\trequestOpenChange(nextOpen, createChangeEventDetails(reason === \"list-navigation\" ? \"keyboard\" : \"trigger-press\", event, refs.reference.current));\n\t});\n\tconst referenceElement = refs.reference.current || null;\n\tconst floatingElement = refs.floating.current || null;\n\tconst interactionContext = React.useMemo(() => ({\n\t\topen,\n\t\tonOpenChange,\n\t\trefs: {\n\t\t\treference: refs.reference,\n\t\t\tfloating: refs.floating,\n\t\t\tdomReference: refs.reference\n\t\t},\n\t\telements: {\n\t\t\treference: referenceElement,\n\t\t\tfloating: floatingElement,\n\t\t\tdomReference: referenceElement\n\t\t},\n\t\tdataRef\n\t}), [\n\t\topen,\n\t\tonOpenChange,\n\t\trefs,\n\t\treferenceElement,\n\t\tfloatingElement\n\t]);\n\tconst interactionsProps = [\n\t\tuseClick(interactionContext, {\n\t\t\tevent: \"mousedown\",\n\t\t\tkeyboardHandlers: false\n\t\t}),\n\t\tuseRole(interactionContext, { role: \"listbox\" }),\n\t\tuseInnerOffset(interactionContext, {\n\t\t\tenabled: !fallback && isScrollable,\n\t\t\tonChange: setInnerOffset,\n\t\t\toverflowRef,\n\t\t\tscrollRef: refs.floating\n\t\t}),\n\t\tuseListNavigation(interactionContext, {\n\t\t\tlistRef: listItemsRef,\n\t\t\tactiveIndex: null,\n\t\t\tselectedIndex,\n\t\t\tonNavigate: (index) => {\n\t\t\t\tif (index !== null) setActiveIndex(index, {\n\t\t\t\t\treason: \"list-navigation\",\n\t\t\t\t\tevent: latestKeyboardEventRef.current,\n\t\t\t\t\ttrigger: void 0,\n\t\t\t\t\tindex\n\t\t\t\t});\n\t\t\t},\n\t\t\tdisabledIndices: registry.getDisabledIndices(),\n\t\t\tscrollItemIntoView: false,\n\t\t\tfocusItemOnHover: false\n\t\t}),\n\t\tuseTypeahead(interactionContext, {\n\t\t\tlistRef: listContentRef,\n\t\t\tonMatch,\n\t\t\tselectedIndex,\n\t\t\tactiveIndex: null,\n\t\t\tonTypingChange: (e) => {\n\t\t\t\tstate.current.isTyping = e;\n\t\t\t}\n\t\t})\n\t];\n\tconst interactions = useInteractions(React.useMemo(() => {\n\t\treturn interactionsProps;\n\t}, interactionsProps));\n\tconst interactionsContext = React.useMemo(() => {\n\t\treturn {\n\t\t\tgetReferenceProps(props2 = {}) {\n\t\t\t\treturn interactions.getReferenceProps({\n\t\t\t\t\t...props2,\n\t\t\t\t\tonKeyDown: composeEventHandlers(props2.onKeyDown, (event) => {\n\t\t\t\t\t\tlatestKeyboardEventRef.current = event.nativeEvent || event;\n\t\t\t\t\t\tif (event.key === \"Enter\" || event.code === \"Space\" || event.key === \" \" && !state.current.isTyping) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\trequestOpenChange(true, createChangeEventDetails(\"keyboard\", event.nativeEvent || event, refs.reference.current));\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t},\n\t\t\tgetFloatingProps(props2) {\n\t\t\t\treturn interactions.getFloatingProps({\n\t\t\t\t\tref: refs.floating,\n\t\t\t\t\t...props2,\n\t\t\t\t\tonPointerEnter() {\n\t\t\t\t\t\tsetControlledScrolling(false);\n\t\t\t\t\t\tstate.current.isMouseOutside = false;\n\t\t\t\t\t},\n\t\t\t\t\tonPointerLeave() {\n\t\t\t\t\t\tstate.current.isMouseOutside = true;\n\t\t\t\t\t},\n\t\t\t\t\tonPointerMove() {\n\t\t\t\t\t\tstate.current.isMouseOutside = false;\n\t\t\t\t\t\tsetControlledScrolling(false);\n\t\t\t\t\t},\n\t\t\t\t\tonKeyDown(event) {\n\t\t\t\t\t\tlatestKeyboardEventRef.current = event.nativeEvent || event;\n\t\t\t\t\t\tsetControlledScrolling(true);\n\t\t\t\t\t},\n\t\t\t\t\tonContextMenu(e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t},\n\t\t\t\t\tonScroll: updateScrollArrows\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}, [\n\t\trefs,\n\t\tinteractions,\n\t\trequestOpenChange,\n\t\tupdateScrollArrows\n\t]);\n\tconst floatingPosition = React.useMemo(() => ({\n\t\tposition: strategy,\n\t\ttop: y ?? \"\",\n\t\tleft: x ?? \"\"\n\t}), [\n\t\tstrategy,\n\t\tx,\n\t\ty\n\t]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (open) {\n\t\t\tallowMouseUpRef.current = false;\n\t\t\tselectTimeoutRef.current = setTimeout(() => {\n\t\t\t\tallowSelectRef.current = true;\n\t\t\t\tallowMouseUpRef.current = true;\n\t\t\t}, 300);\n\t\t\treturn () => {\n\t\t\t\tclearTimeout(selectTimeoutRef.current);\n\t\t\t};\n\t\t}\n\t\tallowSelectRef.current = false;\n\t\tallowMouseUpRef.current = true;\n\t\tsetInnerOffset(0);\n\t\tsetFallback(false);\n\t\tsetBlockSelection(false);\n\t}, [open]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!open && state.current.isMouseOutside) state.current.isMouseOutside = false;\n\t}, [open]);\n\tReact.useEffect(() => {\n\t\tif (!open) return;\n\t\tconst scrollActiveIntoView = (index) => {\n\t\t\tif (controlledScrolling && index != null) listItemsRef.current[index]?.scrollIntoView({ block: \"nearest\" });\n\t\t\tupdateScrollArrows();\n\t\t};\n\t\tscrollActiveIntoView(activeIndexRef.current);\n\t\treturn selectItemParentContext.activeIndexSubscribe(scrollActiveIntoView);\n\t}, [\n\t\topen,\n\t\tcontrolledScrolling,\n\t\tselectItemParentContext.activeIndexSubscribe,\n\t\tupdateScrollArrows\n\t]);\n\tReact.useEffect(() => {\n\t\tif (open && fallback) {\n\t\t\tif (selectedIndex != null) listItemsRef.current[selectedIndex]?.scrollIntoView({ block: \"nearest\" });\n\t\t}\n\t}, [\n\t\topen,\n\t\tfallback,\n\t\tselectedIndex\n\t]);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (refs.floating.current && fallback) refs.floating.current.style.maxHeight = \"\";\n\t}, [refs, fallback]);\n\tconst floatingContext = React.useMemo(() => ({\n\t\trefs,\n\t\tdataRef\n\t}), [refs]);\n\treturn /* @__PURE__ */ jsx(SelectProvider, {\n\t\tscope,\n\t\t...selectContext,\n\t\tupdateScrollArrows,\n\t\tsetInnerOffset,\n\t\tfallback,\n\t\tfloatingContext,\n\t\tinteractions: interactionsContext,\n\t\tfloatingPosition,\n\t\tcanScrollDown: !!showDownArrow,\n\t\tcanScrollUp: !!showUpArrow,\n\t\tcontrolledScrolling,\n\t\tblockSelection,\n\t\tupArrowRef,\n\t\tdownArrowRef,\n\t\tupdate,\n\t\tchildren: /* @__PURE__ */ jsx(SelectItemParentProvider, {\n\t\t\tscope,\n\t\t\t...selectItemParentContext,\n\t\t\tallowMouseUpRef,\n\t\t\tallowSelectRef,\n\t\t\tdataRef,\n\t\t\tgetItemProps: interactions.getItemProps,\n\t\t\tlistRef: listItemsRef,\n\t\t\tselectTimeoutRef,\n\t\t\tchildren\n\t\t})\n\t});\n};\n\nexport { SelectInlineImpl };"],"mappings":";;;;;;;;;;AASA,MAAM,oBAAoB,UAAU;CACnC,MAAM,EAAE,OAAO,UAAU,OAAO,OAAO,mBAAmB;CAC1D,MAAM,gBAAgB,iBAAiB,KAAK;CAC5C,MAAM,0BAA0B,2BAA2B,KAAK;CAChE,MAAM,EAAE,gBAAgB,eAAe,mBAAmB;CAC1D,MAAM,EAAE,mBAAmB,aAAa;CACxC,MAAM,QAAQ,iBAAiB;CAC/B,MAAM,eAAe,wBAAwB;CAC7C,MAAM,cAAc,MAAM,OAAO,IAAI;CACrC,MAAM,aAAa,MAAM,OAAO,IAAI;CACpC,MAAM,eAAe,MAAM,OAAO,IAAI;CACtC,MAAM,iBAAiB,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,UAAU,KAAK,SAAS,QAAQ,MAAM,YAAY;CAChF,GAAG,CAAC,MAAM,QAAQ,CAAC;CACnB,MAAM,kBAAkB,MAAM,eAAe;EAC5C;EACA;CACD,IAAI,CAAC,IAAI,CAAC;CACV,OAAuB,oBAAI,gBAAgB;EAC1C;EACA,GAAG;EACH;EACA;EACA;EACA;EACA,cAAc;EACd;EACA,eAAe,CAAC,CAAC;EACjB,aAAa,CAAC,CAAC;EACf;EACA;EACA;EACA;EACA;EACA,UAA0B,oBAAI,0BAA0B;GACvD;GACA,GAAG;GACH;GACA;GACA;GACA,cAAc,aAAa;GAC3B,SAAS;GACT;GACA;EACD,CAAC;CACF,CAAC;AACF"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var SelectImpl_native_exports = {};
24
+ __export(SelectImpl_native_exports, { SelectInlineImpl: () => SelectInlineImpl });
25
+ module.exports = __toCommonJS(SelectImpl_native_exports);
26
+ var import_jsx_runtime = require("react/jsx-runtime");
27
+ var SelectInlineImpl = function(props) {
28
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
29
+ };
@@ -5,35 +5,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
21
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
23
  var SelectImpl_native_exports = {};
26
- __export(SelectImpl_native_exports, {
27
- SelectInlineImpl: () => SelectInlineImpl
28
- });
24
+ __export(SelectImpl_native_exports, { SelectInlineImpl: () => SelectInlineImpl });
29
25
  module.exports = __toCommonJS(SelectImpl_native_exports);
30
26
  var import_jsx_runtime = require("react/jsx-runtime");
31
- var SelectInlineImpl = function (props) {
32
- if (process.env.NODE_ENV === "development") {
33
- console.warn("Sheet not implemented inline on native");
34
- }
35
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
36
- children: props.children
37
- });
27
+ var SelectInlineImpl = function(props) {
28
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
38
29
  };
30
+
39
31
  //# sourceMappingURL=SelectImpl.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SelectImpl_native_exports","__export","SelectInlineImpl","module","exports","__toCommonJS","import_jsx_runtime","require","props","process","env","NODE_ENV","console","warn","jsx","Fragment","children"],"sources":["../../src/SelectImpl.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA;AAAAC,QAAA,CAAAD,yBAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,yBAAA;AAAA,IAAAM,kBAAA,GAAmDC,OAAA;AAIxC,IAAIL,gBAAA,GAAmB,SAAAA,CAASM,KAAA,EAAO;EAC9C,IAAIC,OAAA,CAAQC,GAAA,CAAIC,QAAA,KAAa,eAAe;IACxCC,OAAA,CAAQC,IAAA,CAAK,wCAAwC;EACzD;EACA,OAAqB,mBAAAP,kBAAA,CAAAQ,GAAA,EAAKR,kBAAA,CAAAS,QAAA,EAAW;IACjCC,QAAA,EAAUR,KAAA,CAAMQ;EACpB,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"file":"SelectImpl.native.js","names":[],"sources":["jsx/SelectImpl.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SelectImpl_native_exports = {};\n__export(SelectImpl_native_exports, {\n SelectInlineImpl: () => SelectInlineImpl\n});\nmodule.exports = __toCommonJS(SelectImpl_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar SelectInlineImpl = function(props) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {\n children: props.children\n });\n};\n//# sourceMappingURL=SelectImpl.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,4BAA4B,CAAC;AACjC,SAAS,2BAA2B,EAClC,wBAAwB,iBAC1B,CAAC;AACD,OAAO,UAAU,aAAa,yBAAyB;AACvD,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,mBAAmB,SAAS,OAAO;CACrC,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,mBAAmB,UAAU,EAC9E,UAAU,MAAM,SAClB,CAAC;AACH"}
@@ -1,189 +1,248 @@
1
1
  import { useComposedRefs } from "@tamagui/compose-refs";
2
+ import { useAdaptIsActive } from "@tamagui/adapt";
2
3
  import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
3
- import { createStyledContext } from "@tamagui/core";
4
- import { ListItem } from "@tamagui/list-item";
4
+ import { View, createChangeEventDetails, createStyledContext, createStyledHOC, styled } from "@tamagui/core";
5
+ import { composeEventHandlers } from "@tamagui/helpers";
5
6
  import * as React from "react";
6
7
  import { useSelectItemParentContext } from "./context.mjs";
8
+ import { getSelectOptionProps } from "./selectionController.mjs";
7
9
  import { jsx } from "react/jsx-runtime";
10
+
8
11
  const ITEM_NAME = "SelectItem";
9
- const {
10
- Provider: SelectItemContextProvider,
11
- useStyledContext: useSelectItemContext
12
- } = createStyledContext(null, ITEM_NAME);
13
- const SelectItem = ListItem.Frame.styleable(function SelectItem2(props, forwardedRef) {
14
- const {
15
- scope,
16
- value,
17
- disabled = false,
18
- textValue: textValueProp,
19
- index,
20
- ...restProps
21
- } = props;
22
- const context = useSelectItemParentContext(scope);
23
- const {
24
- setSelectedIndex,
25
- listRef,
26
- setOpen,
27
- onChange,
28
- activeIndexSubscribe,
29
- activeIndexRef,
30
- valueSubscribe,
31
- allowMouseUpRef,
32
- allowSelectRef,
33
- setValueAtIndex,
34
- selectTimeoutRef,
35
- dataRef,
36
- interactions,
37
- shouldRenderWebNative,
38
- size,
39
- onActiveChange,
40
- initialValue,
41
- setActiveIndexFast
42
- } = context;
43
- const [isSelected, setSelected] = React.useState(initialValue === value);
44
- useIsomorphicLayoutEffect(() => {
45
- if (initialValue === value) {
46
- setSelectedIndex(index);
47
- }
48
- }, []);
49
- React.useEffect(() => {
50
- const handleActiveIndex = i => {
51
- if (index === i) {
52
- onActiveChange(value, index);
53
- if (isWeb) {
54
- requestAnimationFrame(() => {
55
- listRef?.current[index]?.focus();
56
- });
57
- }
58
- }
59
- };
60
- const currentActiveIndex = activeIndexRef?.current;
61
- if (currentActiveIndex !== null && currentActiveIndex !== void 0) {
62
- handleActiveIndex(currentActiveIndex);
63
- }
64
- return activeIndexSubscribe(handleActiveIndex);
65
- }, [index]);
66
- React.useEffect(() => {
67
- return valueSubscribe(val => {
68
- setSelected(val === value);
69
- });
70
- }, [value]);
71
- const textId = React.useId();
72
- const refCallback = React.useCallback(node => {
73
- if (!isWeb) return;
74
- if (node instanceof HTMLElement) {
75
- if (listRef) {
76
- listRef.current[index] = node;
77
- }
78
- }
79
- }, [index, listRef]);
80
- const composedRefs = useComposedRefs(forwardedRef, refCallback);
81
- useIsomorphicLayoutEffect(() => {
82
- setValueAtIndex(index, value);
83
- }, [index, setValueAtIndex, value]);
84
- function handleSelect() {
85
- setSelectedIndex(index);
86
- onChange(value);
87
- setOpen(false);
88
- }
89
- const selectItemProps = React.useMemo(() => {
90
- return interactions ? interactions.getItemProps({
91
- onTouchMove() {
92
- allowSelectRef.current = true;
93
- allowMouseUpRef.current = false;
94
- },
95
- onTouchEnd() {
96
- allowSelectRef.current = false;
97
- allowMouseUpRef.current = true;
98
- },
99
- onKeyDown(event) {
100
- if (event.key === "Enter" || event.key === " " && !dataRef?.current.typing) {
101
- event.preventDefault();
102
- handleSelect();
103
- } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
104
- event.preventDefault();
105
- event.stopPropagation();
106
- const itemCount = listRef?.current.length ?? 0;
107
- if (itemCount === 0) return;
108
- let nextIndex;
109
- if (event.key === "ArrowDown") {
110
- nextIndex = index + 1 >= itemCount ? 0 : index + 1;
111
- } else {
112
- nextIndex = index - 1 < 0 ? itemCount - 1 : index - 1;
113
- }
114
- setActiveIndexFast?.(nextIndex);
115
- } else {
116
- allowSelectRef.current = true;
117
- }
118
- },
119
- onClick() {
120
- if (allowSelectRef.current) {
121
- handleSelect();
122
- }
123
- },
124
- onMouseUp() {
125
- if (!allowMouseUpRef.current) {
126
- allowMouseUpRef.current = true;
127
- allowSelectRef.current = true;
128
- return;
129
- }
130
- if (allowSelectRef.current) {
131
- handleSelect();
132
- }
133
- clearTimeout(selectTimeoutRef.current);
134
- selectTimeoutRef.current = setTimeout(() => {
135
- allowSelectRef.current = true;
136
- });
137
- }
138
- }) : {
139
- onPress: handleSelect
140
- };
141
- }, [handleSelect, index, listRef, setActiveIndexFast]);
142
- return /* @__PURE__ */jsx(SelectItemContextProvider, {
143
- scope,
144
- value,
145
- textId: textId || "",
146
- isSelected,
147
- children: shouldRenderWebNative ? /* @__PURE__ */jsx("option", {
148
- value,
149
- children: props.children
150
- }) : /* @__PURE__ */jsx(ListItem.Frame, {
151
- render: "div",
152
- componentName: ITEM_NAME,
153
- ref: composedRefs,
154
- role: "option",
155
- "aria-labelledby": textId,
156
- "aria-selected": isSelected,
157
- "data-state": isSelected ? "active" : "inactive",
158
- "aria-disabled": disabled || void 0,
159
- "data-disabled": disabled ? "" : void 0,
160
- tabIndex: disabled ? void 0 : -1,
161
- ...(!props.unstyled && {
162
- cursor: "default",
163
- size,
164
- outlineOffset: -0.5,
165
- zIndex: 100,
166
- hoverStyle: {
167
- backgroundColor: "$backgroundHover"
168
- },
169
- pressStyle: {
170
- backgroundColor: "$backgroundPress"
171
- },
172
- focusStyle: {
173
- backgroundColor: "$backgroundFocus"
174
- },
175
- focusVisibleStyle: {
176
- outlineColor: "$outlineColor",
177
- outlineWidth: 1,
178
- outlineStyle: "solid"
179
- }
180
- }),
181
- ...restProps,
182
- ...selectItemProps
183
- })
184
- });
185
- }, {
186
- disableTheme: true
12
+ const { Provider: SelectItemContextProvider, useStyledContext: useSelectItemContext } = createStyledContext(null, ITEM_NAME);
13
+ const SelectItemFrame = styled(View, {
14
+ displayName: ITEM_NAME,
15
+ alignItems: "center",
16
+ flexDirection: "row"
187
17
  });
188
- export { SelectItem, SelectItemContextProvider, useSelectItemContext };
18
+ const SelectItem = createStyledHOC(SelectItemFrame, function SelectItem2(props, forwardedRef) {
19
+ const { scope, value, disabled: disabledProp, "aria-disabled": ariaDisabled, textValue: textValueProp, ...restProps } = props;
20
+ const disabled = disabledProp ?? ariaDisabled === true;
21
+ const context = useSelectItemParentContext(scope);
22
+ const isAdapted = useAdaptIsActive(context.adaptScope);
23
+ const { registry, mode, selectedValues, selectValue, activeIndexSubscribe, activeIndexRef, allowMouseUpRef, allowSelectRef, selectTimeoutRef, getItemProps, shouldRenderWebNative, setActiveIndex, lastPointerRef, moveActive, search } = context;
24
+ const isSelected = selectedValues.includes(value);
25
+ const pendingMouseUpSelectionRef = React.useRef(false);
26
+ const itemNodeRef = React.useRef(null);
27
+ const registrationRef = React.useRef(null);
28
+ const initialRegistration = React.useRef({
29
+ value,
30
+ disabled,
31
+ textValue: textValueProp
32
+ });
33
+ useIsomorphicLayoutEffect(() => {
34
+ const registration = registry.registerItem(initialRegistration.current);
35
+ registrationRef.current = registration;
36
+ registration.setNode(itemNodeRef.current);
37
+ return () => {
38
+ registrationRef.current = null;
39
+ registration.unregister();
40
+ };
41
+ }, [registry]);
42
+ useIsomorphicLayoutEffect(() => {
43
+ registrationRef.current?.update({
44
+ value,
45
+ disabled,
46
+ textValue: textValueProp
47
+ });
48
+ }, [
49
+ disabled,
50
+ textValueProp,
51
+ value
52
+ ]);
53
+ useIsomorphicLayoutEffect(() => {
54
+ registrationRef.current?.setNode(itemNodeRef.current);
55
+ });
56
+ const [isActive, setIsActive] = React.useState(false);
57
+ const isActiveRef = React.useRef(false);
58
+ React.useEffect(() => {
59
+ const handleActiveIndex = (i) => {
60
+ const next = i != null && registry.getIndex(value) === i;
61
+ if (next !== isActiveRef.current) {
62
+ isActiveRef.current = next;
63
+ setIsActive(next);
64
+ }
65
+ if (next && isWeb) {
66
+ requestAnimationFrame(() => {
67
+ itemNodeRef.current?.focus?.();
68
+ });
69
+ }
70
+ };
71
+ handleActiveIndex(activeIndexRef?.current ?? null);
72
+ return activeIndexSubscribe(handleActiveIndex);
73
+ }, [
74
+ activeIndexRef,
75
+ activeIndexSubscribe,
76
+ registry,
77
+ value
78
+ ]);
79
+ const textId = React.useId();
80
+ const refCallback = React.useCallback((node) => {
81
+ itemNodeRef.current = node;
82
+ registrationRef.current?.setNode(node);
83
+ }, []);
84
+ const composedRefs = useComposedRefs(forwardedRef, refCallback);
85
+ const handleSelect = React.useCallback((event, reason = "item-press") => {
86
+ if (disabled) return;
87
+ const nativeEvent = event?.nativeEvent || event;
88
+ selectValue(value, createChangeEventDetails(reason, nativeEvent, event?.currentTarget));
89
+ }, [
90
+ disabled,
91
+ selectValue,
92
+ value
93
+ ]);
94
+ const handleMouseMove = React.useCallback((event) => {
95
+ if (disabled) return;
96
+ const index = registry.getIndex(value);
97
+ if (index < 0) return;
98
+ const last = lastPointerRef.current;
99
+ if (event.clientX === last.x && event.clientY === last.y) return;
100
+ last.x = event.clientX;
101
+ last.y = event.clientY;
102
+ setActiveIndex(index, {
103
+ reason: "item-hover",
104
+ event: event.nativeEvent || event,
105
+ trigger: event.currentTarget,
106
+ index
107
+ });
108
+ }, [
109
+ disabled,
110
+ lastPointerRef,
111
+ registry,
112
+ setActiveIndex,
113
+ value
114
+ ]);
115
+ const handleKeyDown = React.useCallback((event) => {
116
+ if (disabled) return;
117
+ if (event.key === "Enter" || event.key === " ") {
118
+ event.preventDefault();
119
+ handleSelect(event, "keyboard");
120
+ return;
121
+ }
122
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
123
+ event.preventDefault();
124
+ event.stopPropagation();
125
+ moveActive(event.key === "ArrowDown" ? 1 : -1, event.nativeEvent || event);
126
+ return;
127
+ }
128
+ if (!getItemProps && event.key?.length === 1 && !event.metaKey && !event.ctrlKey) {
129
+ search(event.key, event.nativeEvent || event);
130
+ }
131
+ if (allowSelectRef) {
132
+ allowSelectRef.current = true;
133
+ }
134
+ }, [
135
+ allowSelectRef,
136
+ disabled,
137
+ handleSelect,
138
+ getItemProps,
139
+ moveActive,
140
+ search
141
+ ]);
142
+ const selectItemProps = React.useMemo(() => {
143
+ if (getItemProps) {
144
+ const { onTouchMove, onTouchEnd, onKeyDown, onClick, onMouseUp, onMouseMove, onPress, ...itemProps } = restProps;
145
+ const interactionProps = getItemProps({
146
+ ...itemProps,
147
+ onTouchMove() {
148
+ allowSelectRef.current = true;
149
+ allowMouseUpRef.current = false;
150
+ },
151
+ onTouchEnd() {
152
+ allowSelectRef.current = false;
153
+ allowMouseUpRef.current = true;
154
+ },
155
+ onMouseMove: handleMouseMove,
156
+ onKeyDown: handleKeyDown,
157
+ onClick(event) {
158
+ if (disabled) return;
159
+ const shouldSelect = pendingMouseUpSelectionRef.current || allowSelectRef.current;
160
+ pendingMouseUpSelectionRef.current = false;
161
+ clearTimeout(selectTimeoutRef.current);
162
+ allowSelectRef.current = true;
163
+ if (shouldSelect) {
164
+ handleSelect(event);
165
+ }
166
+ },
167
+ onMouseUp(event) {
168
+ if (disabled) return;
169
+ if (!allowMouseUpRef.current) {
170
+ allowMouseUpRef.current = true;
171
+ allowSelectRef.current = true;
172
+ return;
173
+ }
174
+ pendingMouseUpSelectionRef.current = allowSelectRef.current;
175
+ clearTimeout(selectTimeoutRef.current);
176
+ selectTimeoutRef.current = setTimeout(() => {
177
+ allowSelectRef.current = true;
178
+ if (pendingMouseUpSelectionRef.current) {
179
+ pendingMouseUpSelectionRef.current = false;
180
+ handleSelect(event);
181
+ }
182
+ });
183
+ }
184
+ });
185
+ return {
186
+ ...interactionProps,
187
+ onTouchMove: composeEventHandlers(onTouchMove, interactionProps.onTouchMove),
188
+ onTouchEnd: composeEventHandlers(onTouchEnd, interactionProps.onTouchEnd),
189
+ onKeyDown: composeEventHandlers(onKeyDown, interactionProps.onKeyDown),
190
+ onClick(event) {
191
+ onClick?.(event);
192
+ if (event.defaultPrevented) {
193
+ pendingMouseUpSelectionRef.current = false;
194
+ clearTimeout(selectTimeoutRef.current);
195
+ allowSelectRef.current = true;
196
+ return;
197
+ }
198
+ interactionProps.onClick?.(event);
199
+ },
200
+ onMouseUp: composeEventHandlers(onMouseUp, interactionProps.onMouseUp),
201
+ onMouseMove: composeEventHandlers(onMouseMove, interactionProps.onMouseMove),
202
+ onPress
203
+ };
204
+ }
205
+ return {
206
+ ...restProps,
207
+ onKeyDown: composeEventHandlers(restProps.onKeyDown, handleKeyDown),
208
+ onMouseMove: composeEventHandlers(restProps.onMouseMove, handleMouseMove),
209
+ onPress: composeEventHandlers(restProps.onPress, handleSelect)
210
+ };
211
+ }, [
212
+ allowMouseUpRef,
213
+ allowSelectRef,
214
+ disabled,
215
+ handleKeyDown,
216
+ handleMouseMove,
217
+ handleSelect,
218
+ getItemProps,
219
+ restProps,
220
+ selectTimeoutRef
221
+ ]);
222
+ const accessibilityProps = getSelectOptionProps(mode, isSelected, disabled, isWeb ? "web" : "native");
223
+ return /* @__PURE__ */ jsx(SelectItemContextProvider, {
224
+ scope,
225
+ value,
226
+ textId: textId || "",
227
+ textValue: textValueProp,
228
+ isSelected,
229
+ children: shouldRenderWebNative ? /* @__PURE__ */ jsx("option", {
230
+ value,
231
+ disabled,
232
+ children: props.children
233
+ }) : /* @__PURE__ */ jsx(SelectItemFrame, {
234
+ render: "div",
235
+ ref: composedRefs,
236
+ "aria-labelledby": textId,
237
+ "data-state": isSelected ? "active" : "inactive",
238
+ "data-disabled": disabled ? "" : void 0,
239
+ tabIndex: disabled ? void 0 : isWeb && isAdapted && (isActive || activeIndexRef?.current == null && isSelected) ? 0 : -1,
240
+ zIndex: 100,
241
+ ...selectItemProps,
242
+ ...accessibilityProps
243
+ })
244
+ });
245
+ }, { disableTheme: true });
246
+
247
+ export { SelectItem, SelectItemContextProvider, SelectItemFrame, useSelectItemContext };
189
248
  //# sourceMappingURL=SelectItem.mjs.map