@tamagui/select 2.0.0-rc.4 → 2.0.0-rc.40

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 (242) hide show
  1. package/dist/cjs/BubbleSelect.cjs +28 -23
  2. package/dist/cjs/BubbleSelect.native.js +12 -10
  3. package/dist/cjs/BubbleSelect.native.js.map +1 -1
  4. package/dist/cjs/Select.cjs +402 -376
  5. package/dist/cjs/Select.native.js +428 -414
  6. package/dist/cjs/Select.native.js.map +1 -1
  7. package/dist/cjs/SelectContent.cjs +73 -66
  8. package/dist/cjs/SelectContent.native.js +12 -10
  9. package/dist/cjs/SelectContent.native.js.map +1 -1
  10. package/dist/cjs/SelectImpl.cjs +239 -176
  11. package/dist/cjs/SelectImpl.native.js +21 -16
  12. package/dist/cjs/SelectImpl.native.js.map +1 -1
  13. package/dist/cjs/SelectItem.cjs +189 -137
  14. package/dist/cjs/SelectItem.native.js +211 -164
  15. package/dist/cjs/SelectItem.native.js.map +1 -1
  16. package/dist/cjs/SelectItemText.cjs +82 -68
  17. package/dist/cjs/SelectItemText.native.js +81 -69
  18. package/dist/cjs/SelectItemText.native.js.map +1 -1
  19. package/dist/cjs/SelectScrollButton.cjs +104 -83
  20. package/dist/cjs/SelectScrollButton.native.js +17 -15
  21. package/dist/cjs/SelectScrollButton.native.js.map +1 -1
  22. package/dist/cjs/SelectTrigger.cjs +81 -77
  23. package/dist/cjs/SelectTrigger.native.js +43 -40
  24. package/dist/cjs/SelectTrigger.native.js.map +1 -1
  25. package/dist/cjs/SelectViewport.cjs +141 -103
  26. package/dist/cjs/SelectViewport.native.js +39 -37
  27. package/dist/cjs/SelectViewport.native.js.map +1 -1
  28. package/dist/cjs/constants.cjs +19 -17
  29. package/dist/cjs/constants.native.js +19 -17
  30. package/dist/cjs/constants.native.js.map +1 -1
  31. package/dist/cjs/context.cjs +38 -27
  32. package/dist/cjs/context.native.js +46 -38
  33. package/dist/cjs/context.native.js.map +1 -1
  34. package/dist/cjs/index.cjs +7 -5
  35. package/dist/cjs/index.native.js +7 -5
  36. package/dist/cjs/index.native.js.map +1 -1
  37. package/dist/cjs/types.cjs +7 -5
  38. package/dist/cjs/types.native.js +7 -5
  39. package/dist/cjs/types.native.js.map +1 -1
  40. package/dist/cjs/useSelectBreakpointActive.cjs +13 -11
  41. package/dist/cjs/useSelectBreakpointActive.native.js +17 -15
  42. package/dist/cjs/useSelectBreakpointActive.native.js.map +1 -1
  43. package/dist/esm/BubbleSelect.mjs +16 -13
  44. package/dist/esm/BubbleSelect.mjs.map +1 -1
  45. package/dist/esm/Select.mjs +356 -331
  46. package/dist/esm/Select.mjs.map +1 -1
  47. package/dist/esm/Select.native.js +381 -369
  48. package/dist/esm/Select.native.js.map +1 -1
  49. package/dist/esm/SelectContent.mjs +55 -39
  50. package/dist/esm/SelectContent.mjs.map +1 -1
  51. package/dist/esm/SelectImpl.mjs +208 -147
  52. package/dist/esm/SelectImpl.mjs.map +1 -1
  53. package/dist/esm/SelectImpl.native.js +4 -1
  54. package/dist/esm/SelectImpl.native.js.map +1 -1
  55. package/dist/esm/SelectItem.mjs +157 -107
  56. package/dist/esm/SelectItem.mjs.map +1 -1
  57. package/dist/esm/SelectItem.native.js +180 -135
  58. package/dist/esm/SelectItem.native.js.map +1 -1
  59. package/dist/esm/SelectItemText.mjs +50 -38
  60. package/dist/esm/SelectItemText.mjs.map +1 -1
  61. package/dist/esm/SelectItemText.native.js +50 -40
  62. package/dist/esm/SelectItemText.native.js.map +1 -1
  63. package/dist/esm/SelectScrollButton.mjs +74 -55
  64. package/dist/esm/SelectScrollButton.mjs.map +1 -1
  65. package/dist/esm/SelectScrollButton.native.js +5 -5
  66. package/dist/esm/SelectScrollButton.native.js.map +1 -1
  67. package/dist/esm/SelectTrigger.mjs +51 -49
  68. package/dist/esm/SelectTrigger.mjs.map +1 -1
  69. package/dist/esm/SelectTrigger.native.js +13 -12
  70. package/dist/esm/SelectTrigger.native.js.map +1 -1
  71. package/dist/esm/SelectViewport.mjs +108 -83
  72. package/dist/esm/SelectViewport.mjs.map +1 -1
  73. package/dist/esm/SelectViewport.native.js +7 -7
  74. package/dist/esm/SelectViewport.native.js.map +1 -1
  75. package/dist/esm/constants.mjs +7 -7
  76. package/dist/esm/constants.mjs.map +1 -1
  77. package/dist/esm/constants.native.js +7 -7
  78. package/dist/esm/constants.native.js.map +1 -1
  79. package/dist/esm/context.mjs +22 -14
  80. package/dist/esm/context.mjs.map +1 -1
  81. package/dist/esm/context.native.js +30 -25
  82. package/dist/esm/context.native.js.map +1 -1
  83. package/dist/esm/index.js +2 -2
  84. package/dist/esm/index.js.map +1 -6
  85. package/dist/esm/useSelectBreakpointActive.mjs +1 -1
  86. package/dist/esm/useSelectBreakpointActive.mjs.map +1 -1
  87. package/dist/esm/useSelectBreakpointActive.native.js +1 -1
  88. package/dist/esm/useSelectBreakpointActive.native.js.map +1 -1
  89. package/dist/jsx/BubbleSelect.mjs +16 -13
  90. package/dist/jsx/BubbleSelect.mjs.map +1 -1
  91. package/dist/jsx/BubbleSelect.native.js +12 -10
  92. package/dist/jsx/BubbleSelect.native.js.map +1 -1
  93. package/dist/jsx/Select.mjs +356 -331
  94. package/dist/jsx/Select.mjs.map +1 -1
  95. package/dist/jsx/Select.native.js +428 -414
  96. package/dist/jsx/Select.native.js.map +1 -1
  97. package/dist/jsx/SelectContent.mjs +55 -39
  98. package/dist/jsx/SelectContent.mjs.map +1 -1
  99. package/dist/jsx/SelectContent.native.js +12 -10
  100. package/dist/jsx/SelectContent.native.js.map +1 -1
  101. package/dist/jsx/SelectImpl.mjs +208 -147
  102. package/dist/jsx/SelectImpl.mjs.map +1 -1
  103. package/dist/jsx/SelectImpl.native.js +21 -16
  104. package/dist/jsx/SelectImpl.native.js.map +1 -1
  105. package/dist/jsx/SelectItem.mjs +157 -107
  106. package/dist/jsx/SelectItem.mjs.map +1 -1
  107. package/dist/jsx/SelectItem.native.js +211 -164
  108. package/dist/jsx/SelectItem.native.js.map +1 -1
  109. package/dist/jsx/SelectItemText.mjs +50 -38
  110. package/dist/jsx/SelectItemText.mjs.map +1 -1
  111. package/dist/jsx/SelectItemText.native.js +81 -69
  112. package/dist/jsx/SelectItemText.native.js.map +1 -1
  113. package/dist/jsx/SelectScrollButton.mjs +74 -55
  114. package/dist/jsx/SelectScrollButton.mjs.map +1 -1
  115. package/dist/jsx/SelectScrollButton.native.js +17 -15
  116. package/dist/jsx/SelectScrollButton.native.js.map +1 -1
  117. package/dist/jsx/SelectTrigger.mjs +51 -49
  118. package/dist/jsx/SelectTrigger.mjs.map +1 -1
  119. package/dist/jsx/SelectTrigger.native.js +43 -40
  120. package/dist/jsx/SelectTrigger.native.js.map +1 -1
  121. package/dist/jsx/SelectViewport.mjs +108 -83
  122. package/dist/jsx/SelectViewport.mjs.map +1 -1
  123. package/dist/jsx/SelectViewport.native.js +39 -37
  124. package/dist/jsx/SelectViewport.native.js.map +1 -1
  125. package/dist/jsx/constants.mjs +7 -7
  126. package/dist/jsx/constants.mjs.map +1 -1
  127. package/dist/jsx/constants.native.js +19 -17
  128. package/dist/jsx/constants.native.js.map +1 -1
  129. package/dist/jsx/context.mjs +22 -14
  130. package/dist/jsx/context.mjs.map +1 -1
  131. package/dist/jsx/context.native.js +46 -38
  132. package/dist/jsx/context.native.js.map +1 -1
  133. package/dist/jsx/index.js +2 -2
  134. package/dist/jsx/index.js.map +1 -6
  135. package/dist/jsx/index.native.js +7 -5
  136. package/dist/jsx/types.native.js +7 -5
  137. package/dist/jsx/useSelectBreakpointActive.mjs +1 -1
  138. package/dist/jsx/useSelectBreakpointActive.mjs.map +1 -1
  139. package/dist/jsx/useSelectBreakpointActive.native.js +17 -15
  140. package/dist/jsx/useSelectBreakpointActive.native.js.map +1 -1
  141. package/package.json +31 -35
  142. package/src/Select.tsx +16 -1
  143. package/src/SelectContent.tsx +47 -36
  144. package/src/SelectImpl.tsx +51 -49
  145. package/src/SelectItem.tsx +17 -7
  146. package/src/SelectScrollButton.tsx +1 -1
  147. package/src/SelectTrigger.tsx +1 -1
  148. package/src/SelectViewport.tsx +42 -22
  149. package/src/context.tsx +4 -0
  150. package/src/types.tsx +44 -4
  151. package/types/Select.d.ts +2 -2
  152. package/types/Select.d.ts.map +1 -1
  153. package/types/SelectContent.d.ts +1 -1
  154. package/types/SelectContent.d.ts.map +1 -1
  155. package/types/SelectImpl.d.ts.map +1 -1
  156. package/types/SelectItem.d.ts.map +1 -1
  157. package/types/SelectTrigger.d.ts +1 -1
  158. package/types/SelectViewport.d.ts.map +1 -1
  159. package/types/context.d.ts +1 -0
  160. package/types/context.d.ts.map +1 -1
  161. package/types/types.d.ts +33 -3
  162. package/types/types.d.ts.map +1 -1
  163. package/dist/cjs/BubbleSelect.js +0 -34
  164. package/dist/cjs/BubbleSelect.js.map +0 -6
  165. package/dist/cjs/Select.js +0 -402
  166. package/dist/cjs/Select.js.map +0 -6
  167. package/dist/cjs/SelectContent.js +0 -57
  168. package/dist/cjs/SelectContent.js.map +0 -6
  169. package/dist/cjs/SelectImpl.js +0 -222
  170. package/dist/cjs/SelectImpl.js.map +0 -6
  171. package/dist/cjs/SelectItem.js +0 -166
  172. package/dist/cjs/SelectItem.js.map +0 -6
  173. package/dist/cjs/SelectItemText.js +0 -64
  174. package/dist/cjs/SelectItemText.js.map +0 -6
  175. package/dist/cjs/SelectScrollButton.js +0 -105
  176. package/dist/cjs/SelectScrollButton.js.map +0 -6
  177. package/dist/cjs/SelectTrigger.js +0 -81
  178. package/dist/cjs/SelectTrigger.js.map +0 -6
  179. package/dist/cjs/SelectViewport.js +0 -114
  180. package/dist/cjs/SelectViewport.js.map +0 -6
  181. package/dist/cjs/constants.js +0 -27
  182. package/dist/cjs/constants.js.map +0 -6
  183. package/dist/cjs/context.js +0 -33
  184. package/dist/cjs/context.js.map +0 -6
  185. package/dist/cjs/index.js +0 -16
  186. package/dist/cjs/index.js.map +0 -6
  187. package/dist/cjs/types.js +0 -14
  188. package/dist/cjs/types.js.map +0 -6
  189. package/dist/cjs/useSelectBreakpointActive.js +0 -25
  190. package/dist/cjs/useSelectBreakpointActive.js.map +0 -6
  191. package/dist/esm/BubbleSelect.js +0 -17
  192. package/dist/esm/BubbleSelect.js.map +0 -6
  193. package/dist/esm/Select.js +0 -412
  194. package/dist/esm/Select.js.map +0 -6
  195. package/dist/esm/SelectContent.js +0 -39
  196. package/dist/esm/SelectContent.js.map +0 -6
  197. package/dist/esm/SelectImpl.js +0 -223
  198. package/dist/esm/SelectImpl.js.map +0 -6
  199. package/dist/esm/SelectItem.js +0 -148
  200. package/dist/esm/SelectItem.js.map +0 -6
  201. package/dist/esm/SelectItemText.js +0 -46
  202. package/dist/esm/SelectItemText.js.map +0 -6
  203. package/dist/esm/SelectScrollButton.js +0 -87
  204. package/dist/esm/SelectScrollButton.js.map +0 -6
  205. package/dist/esm/SelectTrigger.js +0 -61
  206. package/dist/esm/SelectTrigger.js.map +0 -6
  207. package/dist/esm/SelectViewport.js +0 -112
  208. package/dist/esm/SelectViewport.js.map +0 -6
  209. package/dist/esm/constants.js +0 -11
  210. package/dist/esm/constants.js.map +0 -6
  211. package/dist/esm/context.js +0 -19
  212. package/dist/esm/context.js.map +0 -6
  213. package/dist/esm/types.js +0 -1
  214. package/dist/esm/types.js.map +0 -6
  215. package/dist/esm/useSelectBreakpointActive.js +0 -9
  216. package/dist/esm/useSelectBreakpointActive.js.map +0 -6
  217. package/dist/jsx/BubbleSelect.js +0 -17
  218. package/dist/jsx/BubbleSelect.js.map +0 -6
  219. package/dist/jsx/Select.js +0 -412
  220. package/dist/jsx/Select.js.map +0 -6
  221. package/dist/jsx/SelectContent.js +0 -39
  222. package/dist/jsx/SelectContent.js.map +0 -6
  223. package/dist/jsx/SelectImpl.js +0 -223
  224. package/dist/jsx/SelectImpl.js.map +0 -6
  225. package/dist/jsx/SelectItem.js +0 -148
  226. package/dist/jsx/SelectItem.js.map +0 -6
  227. package/dist/jsx/SelectItemText.js +0 -46
  228. package/dist/jsx/SelectItemText.js.map +0 -6
  229. package/dist/jsx/SelectScrollButton.js +0 -87
  230. package/dist/jsx/SelectScrollButton.js.map +0 -6
  231. package/dist/jsx/SelectTrigger.js +0 -61
  232. package/dist/jsx/SelectTrigger.js.map +0 -6
  233. package/dist/jsx/SelectViewport.js +0 -112
  234. package/dist/jsx/SelectViewport.js.map +0 -6
  235. package/dist/jsx/constants.js +0 -11
  236. package/dist/jsx/constants.js.map +0 -6
  237. package/dist/jsx/context.js +0 -19
  238. package/dist/jsx/context.js.map +0 -6
  239. package/dist/jsx/types.js +0 -1
  240. package/dist/jsx/types.js.map +0 -6
  241. package/dist/jsx/useSelectBreakpointActive.js +0 -9
  242. package/dist/jsx/useSelectBreakpointActive.js.map +0 -6
@@ -2,33 +2,35 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
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: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var Select_exports = {};
33
35
  __export(Select_exports, {
34
36
  Select: () => Select,
@@ -37,63 +39,60 @@ __export(Select_exports, {
37
39
  SelectSeparator: () => SelectSeparator
38
40
  });
39
41
  module.exports = __toCommonJS(Select_exports);
40
- var import_adapt = require("@tamagui/adapt"),
41
- import_compose_refs = require("@tamagui/compose-refs"),
42
- import_constants = require("@tamagui/constants"),
43
- import_core = require("@tamagui/core"),
44
- import_focus_scope = require("@tamagui/focus-scope"),
45
- import_focusable = require("@tamagui/focusable"),
46
- import_get_token = require("@tamagui/get-token"),
47
- import_helpers = require("@tamagui/helpers"),
48
- import_separator = require("@tamagui/separator"),
49
- import_controller = require("@tamagui/sheet/controller"),
50
- import_stacks = require("@tamagui/stacks"),
51
- import_text = require("@tamagui/text"),
52
- import_use_controllable_state = require("@tamagui/use-controllable-state"),
53
- React = __toESM(require("react"), 1),
54
- import_context = require("./context.cjs"),
55
- import_SelectContent = require("./SelectContent.cjs"),
56
- import_SelectImpl = require("./SelectImpl.cjs"),
57
- import_SelectItem = require("./SelectItem.cjs"),
58
- import_SelectItemText = require("./SelectItemText.cjs"),
59
- import_SelectScrollButton = require("./SelectScrollButton.cjs"),
60
- import_SelectTrigger = require("./SelectTrigger.cjs"),
61
- import_SelectViewport = require("./SelectViewport.cjs"),
62
- import_useSelectBreakpointActive = require("./useSelectBreakpointActive.cjs"),
63
- import_jsx_runtime = require("react/jsx-runtime");
64
- const VALUE_NAME = "SelectValue",
65
- SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
66
- name: VALUE_NAME,
67
- userSelect: "none"
68
- }),
69
- SelectValue = SelectValueFrame.styleable(function ({
70
- scope,
71
- children: childrenProp,
72
- placeholder,
73
- ...props
74
- }, forwardedRef) {
75
- const context = (0, import_context.useSelectContext)(scope),
76
- itemParentContext = (0, import_context.useSelectItemParentContext)(scope),
77
- composedRefs = (0, import_compose_refs.useComposedRefs)(
78
- // @ts-ignore TODO react 19 type needs fix
79
- forwardedRef, context.onValueNodeChange),
80
- isEmptyValue = context.value == null || context.value === "",
81
- renderedValue = context.renderValue?.(context.value),
82
- children = childrenProp ?? renderedValue ?? itemParentContext.selectedItem ?? context.value,
83
- selectValueChildren = isEmptyValue ? placeholder ?? children : children;
84
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectValueFrame, {
85
- ...(!props.unstyled && {
86
- size: itemParentContext.size,
87
- ellipsis: !0,
88
- // we don't want events from the portalled `SelectValue` children to bubble
89
- // through the item they came from
90
- pointerEvents: "none"
91
- }),
92
- ref: composedRefs,
93
- ...props,
94
- children: unwrapSelectItem(selectValueChildren)
95
- });
42
+ var import_adapt = require("@tamagui/adapt");
43
+ var import_compose_refs = require("@tamagui/compose-refs");
44
+ var import_constants = require("@tamagui/constants");
45
+ var import_core = require("@tamagui/core");
46
+ var import_focus_scope = require("@tamagui/focus-scope");
47
+ require("@tamagui/focusable");
48
+ var import_get_token = require("@tamagui/get-token");
49
+ var import_helpers = require("@tamagui/helpers");
50
+ var import_separator = require("@tamagui/separator");
51
+ var import_controller = require("@tamagui/sheet/controller");
52
+ var import_stacks = require("@tamagui/stacks");
53
+ var import_text = require("@tamagui/text");
54
+ var import_use_controllable_state = require("@tamagui/use-controllable-state");
55
+ var React = __toESM(require("react"), 1);
56
+ var import_context = require("./context.cjs");
57
+ var import_SelectContent = require("./SelectContent.cjs");
58
+ var import_SelectImpl = require("./SelectImpl.cjs");
59
+ var import_SelectItem = require("./SelectItem.cjs");
60
+ var import_SelectItemText = require("./SelectItemText.cjs");
61
+ var import_SelectScrollButton = require("./SelectScrollButton.cjs");
62
+ var import_SelectTrigger = require("./SelectTrigger.cjs");
63
+ var import_SelectViewport = require("./SelectViewport.cjs");
64
+ var import_useSelectBreakpointActive = require("./useSelectBreakpointActive.cjs");
65
+ var import_jsx_runtime = require("react/jsx-runtime");
66
+ const SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
67
+ name: "SelectValue",
68
+ userSelect: "none"
69
+ });
70
+ const SelectValue = SelectValueFrame.styleable(function SelectValue2({
71
+ scope,
72
+ children: childrenProp,
73
+ placeholder,
74
+ ...props
75
+ }, forwardedRef) {
76
+ const context = (0, import_context.useSelectContext)(scope);
77
+ const itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
78
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(
79
+ // @ts-ignore TODO react 19 type needs fix
80
+ forwardedRef, context.onValueNodeChange);
81
+ const isEmptyValue = context.value == null || context.value === "";
82
+ const renderedValue = context.renderValue?.(context.value);
83
+ const children = childrenProp ?? renderedValue ?? itemParentContext.selectedItem ?? context.value;
84
+ const selectValueChildren = isEmptyValue ? placeholder ?? children : children;
85
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectValueFrame, {
86
+ ...(!props.unstyled && {
87
+ size: itemParentContext.size,
88
+ ellipsis: true,
89
+ pointerEvents: "none"
90
+ }),
91
+ ref: composedRefs,
92
+ ...props,
93
+ children: unwrapSelectItem(selectValueChildren)
96
94
  });
95
+ });
97
96
  function unwrapSelectItem(selectValueChildren) {
98
97
  return React.Children.map(selectValueChildren, child => {
99
98
  if (child) {
@@ -104,341 +103,362 @@ function unwrapSelectItem(selectValueChildren) {
104
103
  });
105
104
  }
106
105
  const SelectIcon = (0, import_core.styled)(import_stacks.XStack, {
107
- name: "SelectIcon",
108
- // @ts-ignore
109
- "aria-hidden": !0,
110
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_text.Paragraph, {
111
- children: "\u25BC"
112
- })
113
- }),
114
- SelectItemIndicatorFrame = (0, import_core.styled)(import_stacks.XStack, {
115
- name: "SelectItemIndicator"
116
- }),
117
- SelectItemIndicator = React.forwardRef(function (props, forwardedRef) {
118
- const {
119
- scope,
120
- ...itemIndicatorProps
121
- } = props,
122
- context = (0, import_context.useSelectItemParentContext)(scope),
123
- itemContext = (0, import_SelectItem.useSelectItemContext)(scope);
124
- return context.shouldRenderWebNative ? null : itemContext.isSelected ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, {
125
- "aria-hidden": !0,
126
- ...itemIndicatorProps,
127
- ref: forwardedRef
128
- }) : null;
129
- }),
130
- SelectIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
131
- name: "SelectIndicator",
132
- variants: {
133
- unstyled: {
134
- false: {
135
- position: "absolute",
136
- top: 0,
137
- left: 0,
138
- pointerEvents: "none",
139
- zIndex: 10,
140
- backgroundColor: "$background",
141
- borderRadius: 0
142
- }
143
- }
144
- },
145
- defaultVariants: {
146
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
147
- }
148
- }),
149
- SelectIndicator = SelectIndicatorFrame.styleable(function ({
106
+ name: "SelectIcon",
107
+ "aria-hidden": true,
108
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_text.Paragraph, {
109
+ children: "▼"
110
+ })
111
+ });
112
+ const SelectItemIndicatorFrame = (0, import_core.styled)(import_stacks.XStack, {
113
+ name: "SelectItemIndicator"
114
+ });
115
+ const SelectItemIndicator = React.forwardRef(function SelectItemIndicator2(props, forwardedRef) {
116
+ const {
150
117
  scope,
151
- ...props
152
- }, forwardedRef) {
153
- const itemContext = (0, import_context.useSelectItemParentContext)(scope),
154
- context = (0, import_context.useSelectContext)(scope),
155
- [layout, setLayout] = React.useState(null),
156
- rafRef = React.useRef(0);
157
- return React.useLayoutEffect(() => {
158
- const update = index => {
159
- typeof index == "number" && (cancelAnimationFrame(rafRef.current), rafRef.current = requestAnimationFrame(() => {
160
- const node = itemContext.listRef?.current?.[index];
161
- node && setLayout({
162
- width: Math.round(node.offsetWidth),
163
- height: Math.round(node.offsetHeight),
164
- x: Math.round(node.offsetLeft),
165
- y: Math.round(node.offsetTop)
166
- });
167
- }));
168
- };
169
- return context.open && context.activeIndexRef.current !== null && update(context.activeIndexRef.current), itemContext.activeIndexSubscribe(update);
170
- }, [context.open, itemContext.listRef]), layout ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectIndicatorFrame, {
171
- ref: forwardedRef,
172
- ...props,
173
- width: layout.width,
174
- height: layout.height,
175
- x: layout.x,
176
- y: layout.y
177
- }) : null;
178
- }),
179
- GROUP_NAME = "SelectGroup",
180
- {
181
- Provider: SelectGroupContextProvider,
182
- useStyledContext: useSelectGroupContext
183
- } = (0, import_core.createStyledContext)({
184
- id: ""
185
- }, "SelectGroup"),
186
- SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
187
- name: GROUP_NAME,
188
- width: "100%"
189
- }),
190
- NativeSelectTextFrame = (0, import_core.styled)(import_text.SizableText, {
191
- render: "select",
192
- backgroundColor: "$background",
193
- borderColor: "$borderColor",
194
- hoverStyle: {
195
- backgroundColor: "$backgroundHover"
118
+ ...itemIndicatorProps
119
+ } = props;
120
+ const context = (0, import_context.useSelectItemParentContext)(scope);
121
+ const itemContext = (0, import_SelectItem.useSelectItemContext)(scope);
122
+ if (context.shouldRenderWebNative) return null;
123
+ return itemContext.isSelected ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, {
124
+ "aria-hidden": true,
125
+ ...itemIndicatorProps,
126
+ ref: forwardedRef
127
+ }) : null;
128
+ });
129
+ const SelectIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
130
+ name: "SelectIndicator",
131
+ variants: {
132
+ unstyled: {
133
+ false: {
134
+ position: "absolute",
135
+ top: 0,
136
+ left: 0,
137
+ pointerEvents: "none",
138
+ zIndex: 10,
139
+ backgroundColor: "$background",
140
+ borderRadius: 0
141
+ }
196
142
  }
197
- }),
198
- NativeSelectFrame = (0, import_core.styled)(import_stacks.YStack, {
199
- name: "NativeSelect",
200
- variants: {
201
- size: {
202
- "...size": (val, extras) => {
203
- const {
204
- tokens
205
- } = extras,
206
- paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]);
207
- return {
208
- borderRadius: tokens.radius[val] ?? val,
209
- minHeight: tokens.size[val],
210
- paddingRight: paddingHorizontal + 20,
211
- paddingLeft: paddingHorizontal,
212
- paddingVertical: (0, import_get_token.getSpace)(val, {
213
- shift: -3
214
- })
215
- };
216
- }
217
- },
218
- unstyled: {
219
- false: {
220
- borderWidth: 1,
221
- borderColor: "$borderColor",
222
- userSelect: "none",
223
- outlineWidth: 0,
224
- paddingRight: 10
225
- }
143
+ },
144
+ defaultVariants: {
145
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
146
+ }
147
+ });
148
+ const SelectIndicator = SelectIndicatorFrame.styleable(function SelectIndicator2({
149
+ scope,
150
+ ...props
151
+ }, forwardedRef) {
152
+ const itemContext = (0, import_context.useSelectItemParentContext)(scope);
153
+ const context = (0, import_context.useSelectContext)(scope);
154
+ const [layout, setLayout] = React.useState(null);
155
+ const rafRef = React.useRef(0);
156
+ React.useLayoutEffect(() => {
157
+ const update = index => {
158
+ if (typeof index !== "number") return;
159
+ cancelAnimationFrame(rafRef.current);
160
+ rafRef.current = requestAnimationFrame(() => {
161
+ const node = itemContext.listRef?.current?.[index];
162
+ if (node) setLayout({
163
+ width: Math.round(node.offsetWidth),
164
+ height: Math.round(node.offsetHeight),
165
+ x: Math.round(node.offsetLeft),
166
+ y: Math.round(node.offsetTop)
167
+ });
168
+ });
169
+ };
170
+ if (context.open && context.activeIndexRef.current !== null) update(context.activeIndexRef.current);
171
+ return itemContext.activeIndexSubscribe(update);
172
+ }, [context.open, itemContext.listRef]);
173
+ if (!layout) return null;
174
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectIndicatorFrame, {
175
+ ref: forwardedRef,
176
+ ...props,
177
+ width: layout.width,
178
+ height: layout.height,
179
+ x: layout.x,
180
+ y: layout.y
181
+ });
182
+ });
183
+ const GROUP_NAME = "SelectGroup";
184
+ const {
185
+ Provider: SelectGroupContextProvider,
186
+ useStyledContext: useSelectGroupContext
187
+ } = (0, import_core.createStyledContext)({
188
+ id: ""
189
+ }, "SelectGroup");
190
+ const SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
191
+ name: GROUP_NAME,
192
+ width: "100%"
193
+ });
194
+ const NativeSelectTextFrame = (0, import_core.styled)(import_text.SizableText, {
195
+ render: "select",
196
+ backgroundColor: "$background",
197
+ borderColor: "$borderColor",
198
+ hoverStyle: {
199
+ backgroundColor: "$backgroundHover"
200
+ }
201
+ });
202
+ const NativeSelectFrame = (0, import_core.styled)(import_stacks.YStack, {
203
+ name: "NativeSelect",
204
+ variants: {
205
+ size: {
206
+ "...size": (val, extras) => {
207
+ const {
208
+ tokens
209
+ } = extras;
210
+ const paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]);
211
+ return {
212
+ borderRadius: tokens.radius[val] ?? val,
213
+ minHeight: tokens.size[val],
214
+ paddingRight: paddingHorizontal + 20,
215
+ paddingLeft: paddingHorizontal,
216
+ paddingVertical: (0, import_get_token.getSpace)(val, {
217
+ shift: -3
218
+ })
219
+ };
226
220
  }
227
221
  },
228
- defaultVariants: {
229
- size: "$2",
230
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
222
+ unstyled: {
223
+ false: {
224
+ borderWidth: 1,
225
+ borderColor: "$borderColor",
226
+ userSelect: "none",
227
+ outlineWidth: 0,
228
+ paddingRight: 10
229
+ }
231
230
  }
232
- }),
233
- SelectGroup = React.forwardRef((props, forwardedRef) => {
234
- const {
235
- scope,
236
- ...groupProps
237
- } = props,
238
- groupId = React.useId(),
239
- context = (0, import_context.useSelectContext)(scope),
240
- itemParentContext = (0, import_context.useSelectItemParentContext)(scope),
241
- size = itemParentContext.size ?? "$true",
242
- nativeSelectRef = React.useRef(null),
243
- content = itemParentContext.shouldRenderWebNative ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(NativeSelectFrame, {
244
- asChild: !0,
231
+ },
232
+ defaultVariants: {
233
+ size: "$2",
234
+ unstyled: process.env.TAMAGUI_HEADLESS === "1" ? true : false
235
+ }
236
+ });
237
+ const SelectGroup = React.forwardRef((props, forwardedRef) => {
238
+ const {
239
+ scope,
240
+ ...groupProps
241
+ } = props;
242
+ const groupId = React.useId();
243
+ const context = (0, import_context.useSelectContext)(scope);
244
+ const itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
245
+ const size = itemParentContext.size ?? "$true";
246
+ const nativeSelectRef = React.useRef(null);
247
+ const content = (() => {
248
+ if (itemParentContext.shouldRenderWebNative) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(NativeSelectFrame, {
249
+ asChild: true,
250
+ size,
251
+ value: context.value,
252
+ id: itemParentContext.id,
253
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(NativeSelectTextFrame, {
254
+ onChange: event => {
255
+ itemParentContext.onChange(event.currentTarget.value);
256
+ },
245
257
  size,
246
- value: context.value,
247
- id: itemParentContext.id,
248
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(NativeSelectTextFrame, {
249
- onChange: event => {
250
- itemParentContext.onChange(event.currentTarget.value);
251
- },
252
- size,
253
- ref: nativeSelectRef,
254
- style: {
255
- color: "var(--color)",
256
- // @ts-ignore
257
- appearance: "none"
258
- },
259
- children: props.children
260
- })
261
- }) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectGroupFrame, {
262
- role: "group",
263
- "aria-labelledby": groupId,
264
- ...groupProps,
265
- ref: forwardedRef
266
- });
267
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectGroupContextProvider, {
268
- scope,
269
- id: groupId || "",
270
- children: content
258
+ ref: nativeSelectRef,
259
+ style: {
260
+ color: "var(--color)",
261
+ appearance: "none"
262
+ },
263
+ children: props.children
264
+ })
265
+ });
266
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectGroupFrame, {
267
+ role: "group",
268
+ "aria-labelledby": groupId,
269
+ ...groupProps,
270
+ ref: forwardedRef
271
271
  });
272
+ })();
273
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectGroupContextProvider, {
274
+ scope,
275
+ id: groupId || "",
276
+ children: content
272
277
  });
278
+ });
273
279
  SelectGroup.displayName = GROUP_NAME;
274
- const LABEL_NAME = "SelectLabel",
275
- SelectLabelFrame = (0, import_core.styled)(import_text.SizableText, {
276
- name: LABEL_NAME,
277
- variants: {
278
- unstyled: {
279
- false: {
280
- size: "$true",
281
- ellipsis: !0,
282
- maxWidth: "100%",
283
- cursor: "default"
284
- }
285
- },
286
- size: {
287
- "...size": (val, {
288
- tokens
289
- }) => ({
280
+ const SelectLabelFrame = (0, import_core.styled)(import_text.SizableText, {
281
+ name: "SelectLabel",
282
+ variants: {
283
+ unstyled: {
284
+ false: {
285
+ size: "$true",
286
+ ellipsis: true,
287
+ maxWidth: "100%",
288
+ cursor: "default"
289
+ }
290
+ },
291
+ size: {
292
+ "...size": (val, {
293
+ tokens
294
+ }) => {
295
+ return {
290
296
  paddingHorizontal: tokens.space[val],
291
297
  paddingVertical: (0, import_get_token.getSpace)(tokens.space[val], {
292
298
  shift: -4
293
299
  })
294
- })
300
+ };
295
301
  }
296
- },
297
- defaultVariants: {
298
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
299
302
  }
300
- }),
301
- SelectLabel = SelectLabelFrame.styleable((props, forwardedRef) => {
302
- const {
303
- scope,
304
- ...labelProps
305
- } = props,
306
- context = (0, import_context.useSelectItemParentContext)(scope),
307
- groupContext = useSelectGroupContext(scope);
308
- return context.shouldRenderWebNative ? null : /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectLabelFrame, {
309
- render: "div",
310
- id: groupContext.id,
311
- size: context.size,
312
- ...labelProps,
313
- ref: forwardedRef
314
- });
315
- }),
316
- SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
317
- name: "SelectSeparator"
318
- }),
319
- SelectSheetController = props => {
320
- const context = (0, import_context.useSelectContext)(props.scope),
321
- showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context),
322
- isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope),
323
- getShowSheet = (0, import_core.useGet)(showSheet);
324
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_controller.SheetController, {
325
- onOpenChange: val => {
326
- getShowSheet() && props.onOpenChange(val);
327
- },
328
- open: context.open,
329
- hidden: !isAdapted,
330
- children: props.children
331
- });
332
303
  },
333
- SelectSheetImpl = props => /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
304
+ defaultVariants: {
305
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
306
+ }
307
+ });
308
+ const SelectLabel = SelectLabelFrame.styleable((props, forwardedRef) => {
309
+ const {
310
+ scope,
311
+ ...labelProps
312
+ } = props;
313
+ const context = (0, import_context.useSelectItemParentContext)(scope);
314
+ const groupContext = useSelectGroupContext(scope);
315
+ if (context.shouldRenderWebNative) return null;
316
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectLabelFrame, {
317
+ render: "div",
318
+ id: groupContext.id,
319
+ size: context.size,
320
+ ...labelProps,
321
+ ref: forwardedRef
322
+ });
323
+ });
324
+ const SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
325
+ name: "SelectSeparator"
326
+ });
327
+ const SelectSheetController = props => {
328
+ const context = (0, import_context.useSelectContext)(props.scope);
329
+ const showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context);
330
+ const isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
331
+ const getShowSheet = (0, import_core.useGet)(showSheet);
332
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_controller.SheetController, {
333
+ onOpenChange: val => {
334
+ if (getShowSheet()) props.onOpenChange(val);
335
+ },
336
+ open: context.open,
337
+ hidden: !isAdapted,
334
338
  children: props.children
335
- }),
336
- Select = (0, import_helpers.withStaticProperties)(function (props) {
337
- const adaptScope = `AdaptSelect${props.scope || ""}`;
338
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_adapt.AdaptParent, {
339
- scope: adaptScope,
340
- portal: !0,
341
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectInner, {
342
- scope: props.scope,
343
- adaptScope,
344
- ...props
345
- })
346
- });
347
- }, {
348
- Adapt: import_adapt.Adapt,
349
- Content: import_SelectContent.SelectContent,
350
- Group: SelectGroup,
351
- Icon: SelectIcon,
352
- Item: import_SelectItem.SelectItem,
353
- ItemIndicator: SelectItemIndicator,
354
- ItemText: import_SelectItemText.SelectItemText,
355
- Label: SelectLabel,
356
- ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
357
- ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
358
- Trigger: import_SelectTrigger.SelectTrigger,
359
- Value: SelectValue,
360
- Viewport: import_SelectViewport.SelectViewport,
361
- Indicator: SelectIndicator,
362
- FocusScope: import_focus_scope.FocusScopeController
363
339
  });
340
+ };
341
+ const SelectSheetImpl = props => {
342
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
343
+ children: props.children
344
+ });
345
+ };
346
+ const Select = (0, import_helpers.withStaticProperties)(function Select2(props) {
347
+ const adaptScope = `AdaptSelect${props.scope || ""}`;
348
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_adapt.AdaptParent, {
349
+ scope: adaptScope,
350
+ portal: true,
351
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectInner, {
352
+ scope: props.scope,
353
+ adaptScope,
354
+ ...props
355
+ })
356
+ });
357
+ }, {
358
+ Adapt: import_adapt.Adapt,
359
+ Content: import_SelectContent.SelectContent,
360
+ Group: SelectGroup,
361
+ Icon: SelectIcon,
362
+ Item: import_SelectItem.SelectItem,
363
+ ItemIndicator: SelectItemIndicator,
364
+ ItemText: import_SelectItemText.SelectItemText,
365
+ Label: SelectLabel,
366
+ ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
367
+ ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
368
+ Trigger: import_SelectTrigger.SelectTrigger,
369
+ Value: SelectValue,
370
+ Viewport: import_SelectViewport.SelectViewport,
371
+ Indicator: SelectIndicator,
372
+ FocusScope: import_focus_scope.FocusScopeController
373
+ });
364
374
  function useEmitter() {
365
- const listenersRef = React.useRef(/* @__PURE__ */new Set()),
366
- emit = React.useCallback(value => {
367
- listenersRef.current.forEach(l => l(value));
368
- }, []),
369
- subscribe = React.useCallback(listener => (listenersRef.current.add(listener), () => {
375
+ const listenersRef = React.useRef(/* @__PURE__ */new Set());
376
+ return [React.useCallback(value => {
377
+ listenersRef.current.forEach(l => l(value));
378
+ }, []), React.useCallback(listener => {
379
+ listenersRef.current.add(listener);
380
+ return () => {
370
381
  listenersRef.current.delete(listener);
371
- }), []);
372
- return [emit, subscribe];
382
+ };
383
+ }, [])];
373
384
  }
374
385
  function SelectInner(props) {
375
386
  const {
376
- scope = "",
377
- adaptScope,
378
- native,
379
- children,
380
- open: openProp,
381
- defaultOpen,
382
- onOpenChange,
383
- value: valueProp,
384
- defaultValue,
385
- onValueChange,
386
- disablePreventBodyScroll,
387
- size: sizeProp = "$true",
388
- onActiveChange,
389
- dir,
390
- id,
391
- renderValue
392
- } = props,
393
- SelectImpl = (0, import_adapt.useAdaptIsActive)(adaptScope) || !import_constants.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl,
394
- forceUpdate = React.useReducer(() => ({}), {})[1],
395
- [selectedItem, setSelectedItem] = React.useState(null),
396
- [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
397
- prop: openProp,
398
- defaultProp: defaultOpen || !1,
399
- onChange: onOpenChange
400
- }),
401
- [value, setValue] = (0, import_use_controllable_state.useControllableState)({
402
- prop: valueProp,
403
- defaultProp: defaultValue || "",
404
- onChange: onValueChange,
405
- transition: !0
406
- });
387
+ scope = "",
388
+ adaptScope,
389
+ native,
390
+ children,
391
+ open: openProp,
392
+ defaultOpen,
393
+ onOpenChange,
394
+ value: valueProp,
395
+ defaultValue,
396
+ onValueChange,
397
+ disablePreventBodyScroll,
398
+ size: sizeProp = "$true",
399
+ onActiveChange,
400
+ dir,
401
+ id,
402
+ renderValue,
403
+ lazyMount,
404
+ zIndex
405
+ } = props;
406
+ const SelectImpl = (0, import_adapt.useAdaptIsActive)(adaptScope) || !import_constants.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl;
407
+ const forceUpdate = React.useReducer(() => ({}), {})[1];
408
+ const [selectedItem, setSelectedItem] = React.useState(null);
409
+ const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
410
+ prop: openProp,
411
+ defaultProp: defaultOpen || false,
412
+ onChange: onOpenChange
413
+ });
414
+ const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
415
+ prop: valueProp,
416
+ defaultProp: defaultValue || "",
417
+ onChange: onValueChange,
418
+ transition: true
419
+ });
420
+ React.useEffect(() => {
421
+ if (open) emitValue(value);
422
+ }, [open]);
407
423
  React.useEffect(() => {
408
- open && emitValue(value);
409
- }, [open]), React.useEffect(() => {
410
424
  emitValue(value);
411
425
  }, [value]);
412
- const activeIndexRef = React.useRef(null),
413
- [activeIndex, setActiveIndexState] = React.useState(null),
414
- [emitValue, valueSubscribe] = useEmitter(),
415
- [emitActiveIndex, activeIndexSubscribe] = useEmitter(),
416
- selectedIndexRef = React.useRef(null),
417
- listContentRef = React.useRef([]),
418
- [selectedIndex, setSelectedIndex] = React.useState(0),
419
- [valueNode, setValueNode] = React.useState(null);
426
+ const activeIndexRef = React.useRef(null);
427
+ const [activeIndex, setActiveIndexState] = React.useState(null);
428
+ const [emitValue, valueSubscribe] = useEmitter();
429
+ const [emitActiveIndex, activeIndexSubscribe] = useEmitter();
430
+ const selectedIndexRef = React.useRef(null);
431
+ const listContentRef = React.useRef([]);
432
+ const [selectedIndex, setSelectedIndex] = React.useState(0);
433
+ const [valueNode, setValueNode] = React.useState(null);
420
434
  (0, import_constants.useIsomorphicLayoutEffect)(() => {
421
435
  selectedIndexRef.current = selectedIndex;
422
436
  });
423
- const shouldRenderWebNative = import_constants.isWeb && (native === !0 || native === "web" || Array.isArray(native) && native.includes("web")),
424
- setActiveIndexFast = React.useCallback(index => {
425
- activeIndexRef.current !== index && (activeIndexRef.current = index, typeof index == "number" && emitActiveIndex(index));
426
- }, [emitActiveIndex]),
427
- setActiveIndex = React.useCallback(index => {
428
- setActiveIndexFast(index), setActiveIndexState(index);
429
- }, [setActiveIndexFast]);
430
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.SelectItemParentProvider, {
437
+ const shouldRenderWebNative = import_constants.isWeb && (native === true || native === "web" || Array.isArray(native) && native.includes("web"));
438
+ const setActiveIndexFast = React.useCallback(index => {
439
+ if (activeIndexRef.current !== index) {
440
+ activeIndexRef.current = index;
441
+ if (typeof index === "number") emitActiveIndex(index);
442
+ }
443
+ }, [emitActiveIndex]);
444
+ const setActiveIndex = React.useCallback(index => {
445
+ setActiveIndexFast(index);
446
+ setActiveIndexState(index);
447
+ }, [setActiveIndexFast]);
448
+ const content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.SelectItemParentProvider, {
431
449
  scopeName: scope,
432
450
  scope,
433
451
  adaptScope,
434
452
  initialValue: React.useMemo(() => value, [open]),
435
453
  size: sizeProp,
436
454
  activeIndexSubscribe,
455
+ activeIndexRef,
437
456
  valueSubscribe,
438
457
  setOpen,
439
458
  id,
440
459
  onChange: React.useCallback(val => {
441
- setValue(val), emitValue(val);
460
+ setValue(val);
461
+ emitValue(val);
442
462
  }, []),
443
463
  onActiveChange: (0, import_core.useEvent)((value2, index) => {
444
464
  onActiveChange?.(value2, index);
@@ -457,8 +477,8 @@ function SelectInner(props) {
457
477
  adaptScope,
458
478
  disablePreventBodyScroll,
459
479
  dir,
460
- blockSelection: !1,
461
- fallback: !1,
480
+ blockSelection: false,
481
+ fallback: false,
462
482
  forceUpdate,
463
483
  valueNode,
464
484
  onValueNodeChange: setValueNode,
@@ -470,6 +490,7 @@ function SelectInner(props) {
470
490
  open,
471
491
  native,
472
492
  renderValue,
493
+ lazyMount,
473
494
  children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectSheetController, {
474
495
  onOpenChange: setOpen,
475
496
  scope,
@@ -486,4 +507,9 @@ function SelectInner(props) {
486
507
  })
487
508
  })
488
509
  });
510
+ if (zIndex !== void 0) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.SelectZIndexContext.Provider, {
511
+ value: zIndex,
512
+ children: content
513
+ });
514
+ return content;
489
515
  }