@tamagui/select 3.0.0-beta.924.1 → 3.0.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 (106) hide show
  1. package/dist/cjs/Select.cjs +23 -25
  2. package/dist/cjs/Select.native.cjs +27 -26
  3. package/dist/cjs/Select.native.js +27 -26
  4. package/dist/cjs/Select.native.js.map +1 -1
  5. package/dist/cjs/SelectImpl.cjs +67 -63
  6. package/dist/cjs/SelectItem.cjs +49 -60
  7. package/dist/cjs/SelectItem.native.cjs +51 -79
  8. package/dist/cjs/SelectItem.native.js +51 -79
  9. package/dist/cjs/SelectItem.native.js.map +1 -1
  10. package/dist/cjs/SelectScrollButton.cjs +9 -25
  11. package/dist/cjs/SelectTrigger.cjs +22 -5
  12. package/dist/cjs/SelectTrigger.native.cjs +15 -5
  13. package/dist/cjs/SelectTrigger.native.js +15 -5
  14. package/dist/cjs/SelectTrigger.native.js.map +1 -1
  15. package/dist/cjs/SelectViewport.cjs +29 -32
  16. package/dist/cjs/SelectViewport.native.cjs +2 -2
  17. package/dist/cjs/SelectViewport.native.js +2 -2
  18. package/dist/cjs/SelectViewport.native.js.map +1 -1
  19. package/dist/cjs/selectionController.cjs +15 -5
  20. package/dist/cjs/selectionController.native.cjs +20 -15
  21. package/dist/cjs/selectionController.native.js +20 -15
  22. package/dist/cjs/selectionController.native.js.map +1 -1
  23. package/dist/esm/Select.mjs +27 -28
  24. package/dist/esm/Select.mjs.map +1 -1
  25. package/dist/esm/Select.native.js +31 -29
  26. package/dist/esm/Select.native.js.map +1 -1
  27. package/dist/esm/SelectImpl.mjs +68 -64
  28. package/dist/esm/SelectImpl.mjs.map +1 -1
  29. package/dist/esm/SelectItem.mjs +50 -61
  30. package/dist/esm/SelectItem.mjs.map +1 -1
  31. package/dist/esm/SelectItem.native.js +52 -80
  32. package/dist/esm/SelectItem.native.js.map +1 -1
  33. package/dist/esm/SelectScrollButton.mjs +10 -26
  34. package/dist/esm/SelectScrollButton.mjs.map +1 -1
  35. package/dist/esm/SelectTrigger.mjs +16 -5
  36. package/dist/esm/SelectTrigger.mjs.map +1 -1
  37. package/dist/esm/SelectTrigger.native.js +15 -4
  38. package/dist/esm/SelectTrigger.native.js.map +1 -1
  39. package/dist/esm/SelectViewport.mjs +30 -33
  40. package/dist/esm/SelectViewport.mjs.map +1 -1
  41. package/dist/esm/SelectViewport.native.js +3 -3
  42. package/dist/esm/SelectViewport.native.js.map +1 -1
  43. package/dist/esm/selectionController.mjs +15 -5
  44. package/dist/esm/selectionController.mjs.map +1 -1
  45. package/dist/esm/selectionController.native.js +20 -15
  46. package/dist/esm/selectionController.native.js.map +1 -1
  47. package/dist/jsx/Select.mjs +27 -28
  48. package/dist/jsx/Select.mjs.map +1 -1
  49. package/dist/jsx/Select.native.cjs +27 -26
  50. package/dist/jsx/Select.native.js +27 -26
  51. package/dist/jsx/Select.native.js.map +1 -1
  52. package/dist/jsx/SelectImpl.mjs +68 -64
  53. package/dist/jsx/SelectImpl.mjs.map +1 -1
  54. package/dist/jsx/SelectItem.mjs +50 -61
  55. package/dist/jsx/SelectItem.mjs.map +1 -1
  56. package/dist/jsx/SelectItem.native.cjs +51 -79
  57. package/dist/jsx/SelectItem.native.js +51 -79
  58. package/dist/jsx/SelectItem.native.js.map +1 -1
  59. package/dist/jsx/SelectScrollButton.mjs +10 -26
  60. package/dist/jsx/SelectScrollButton.mjs.map +1 -1
  61. package/dist/jsx/SelectTrigger.mjs +16 -5
  62. package/dist/jsx/SelectTrigger.mjs.map +1 -1
  63. package/dist/jsx/SelectTrigger.native.cjs +15 -5
  64. package/dist/jsx/SelectTrigger.native.js +15 -5
  65. package/dist/jsx/SelectTrigger.native.js.map +1 -1
  66. package/dist/jsx/SelectViewport.mjs +30 -33
  67. package/dist/jsx/SelectViewport.mjs.map +1 -1
  68. package/dist/jsx/SelectViewport.native.cjs +2 -2
  69. package/dist/jsx/SelectViewport.native.js +2 -2
  70. package/dist/jsx/SelectViewport.native.js.map +1 -1
  71. package/dist/jsx/selectionController.mjs +15 -5
  72. package/dist/jsx/selectionController.mjs.map +1 -1
  73. package/dist/jsx/selectionController.native.cjs +20 -15
  74. package/dist/jsx/selectionController.native.js +20 -15
  75. package/dist/jsx/selectionController.native.js.map +1 -1
  76. package/package.json +30 -29
  77. package/src/Select.tsx +41 -41
  78. package/src/SelectImpl.tsx +107 -95
  79. package/src/SelectItem.tsx +66 -91
  80. package/src/SelectScrollButton.tsx +14 -32
  81. package/src/SelectTrigger.tsx +19 -2
  82. package/src/SelectViewport.native.tsx +4 -4
  83. package/src/SelectViewport.tsx +34 -30
  84. package/src/selectionController.ts +20 -5
  85. package/src/types.tsx +26 -22
  86. package/types/Select.d.ts +42 -81
  87. package/types/Select.d.ts.map +1 -1
  88. package/types/SelectImpl.d.ts.map +1 -1
  89. package/types/SelectItem.d.ts +3 -5
  90. package/types/SelectItem.d.ts.map +1 -1
  91. package/types/SelectItemText.d.ts +3 -5
  92. package/types/SelectItemText.d.ts.map +1 -1
  93. package/types/SelectScrollButton.d.ts +5 -9
  94. package/types/SelectScrollButton.d.ts.map +1 -1
  95. package/types/SelectScrollButton.native.d.ts +5 -9
  96. package/types/SelectScrollButton.native.d.ts.map +1 -1
  97. package/types/SelectTrigger.d.ts +3 -5
  98. package/types/SelectTrigger.d.ts.map +1 -1
  99. package/types/SelectViewport.d.ts +4 -9
  100. package/types/SelectViewport.d.ts.map +1 -1
  101. package/types/SelectViewport.native.d.ts +4 -9
  102. package/types/SelectViewport.native.d.ts.map +1 -1
  103. package/types/selectionController.d.ts +2 -0
  104. package/types/selectionController.d.ts.map +1 -1
  105. package/types/types.d.ts +30 -22
  106. package/types/types.d.ts.map +1 -1
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all) __defProp(target, name, {
@@ -17,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
17
19
  }
18
20
  return to;
19
21
  };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
20
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
27
  var SelectTrigger_exports = {};
22
28
  __export(SelectTrigger_exports, {
@@ -28,6 +34,7 @@ var import_compose_refs = require("@tamagui/compose-refs");
28
34
  var import_constants = require("@tamagui/constants");
29
35
  var import_core = require("@tamagui/core");
30
36
  var import_helpers = require("@tamagui/helpers");
37
+ var React = __toESM(require("react"), 1);
31
38
  var import_context = require("./context.cjs");
32
39
  var import_jsx_runtime = require("react/jsx-runtime");
33
40
  const SelectTriggerFrame = (0, import_core.styled)(import_core.View, {
@@ -41,19 +48,29 @@ const SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, funct
41
48
  const context = (0, import_context.useSelectContext)(scope);
42
49
  const itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
43
50
  const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.floatingContext?.refs.setReference);
51
+ const pressIsTouch = React.useRef(false);
44
52
  if (itemParentContext.shouldRenderWebNative) return null;
45
53
  const toggleOpen = (event, reason = "trigger-press") => {
46
54
  if (!disabled) itemParentContext.requestOpenChange(!context.open, (0, import_core.createChangeEventDetails)(reason, event?.nativeEvent || event, event?.currentTarget));
47
55
  };
48
- const interactionProps = itemParentContext.interactions ? itemParentContext.interactions.getReferenceProps({
56
+ const interactionProps = context.interactions ? context.interactions.getReferenceProps({
49
57
  ...triggerProps,
50
58
  onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, () => context.floatingContext?.update?.())
51
59
  }) : {
52
60
  ...triggerProps,
53
- ...import_constants.isWeb ? { onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, (event) => {
54
- event.preventDefault();
55
- toggleOpen(event);
56
- }) } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
61
+ ...import_constants.isWeb ? {
62
+ onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, (event) => {
63
+ pressIsTouch.current = event.type === "touchstart";
64
+ if (pressIsTouch.current) return;
65
+ event.preventDefault();
66
+ toggleOpen(event);
67
+ }),
68
+ onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, (event) => {
69
+ if (!pressIsTouch.current) return;
70
+ pressIsTouch.current = false;
71
+ toggleOpen(event);
72
+ })
73
+ } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
57
74
  onKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, (event) => {
58
75
  if (event.key === "Enter" || event.key === " ") {
59
76
  event.preventDefault();
@@ -37,7 +37,7 @@ var import_compose_refs = require("@tamagui/compose-refs");
37
37
  var import_constants = require("@tamagui/constants");
38
38
  var import_core = require("@tamagui/core");
39
39
  var import_helpers = require("@tamagui/helpers");
40
- __toESM(require("react"), 1);
40
+ var React = __toESM(require("react"), 1);
41
41
  var import_context = require("./context.native.js");
42
42
  var SelectTriggerFrame = (0, import_core.styled)(import_core.View, {
43
43
  displayName: "SelectTrigger",
@@ -51,6 +51,7 @@ var SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, functio
51
51
  var context = (0, import_context.useSelectContext)(scope);
52
52
  var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
53
53
  var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);
54
+ var pressIsTouch = React.useRef(false);
54
55
  if (itemParentContext.shouldRenderWebNative) return null;
55
56
  var toggleOpen = function(event) {
56
57
  var reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "trigger-press";
@@ -58,10 +59,19 @@ var SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, functio
58
59
  };
59
60
  var interactionProps = {
60
61
  ...triggerProps,
61
- ...import_constants.isWeb ? { onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {
62
- event.preventDefault();
63
- toggleOpen(event);
64
- }) } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
62
+ ...import_constants.isWeb ? {
63
+ onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {
64
+ pressIsTouch.current = event.type === "touchstart";
65
+ if (pressIsTouch.current) return;
66
+ event.preventDefault();
67
+ toggleOpen(event);
68
+ }),
69
+ onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, function(event) {
70
+ if (!pressIsTouch.current) return;
71
+ pressIsTouch.current = false;
72
+ toggleOpen(event);
73
+ })
74
+ } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
65
75
  onKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, function(event) {
66
76
  if (event.key === "Enter" || event.key === " ") {
67
77
  event.preventDefault();
@@ -37,7 +37,7 @@ var import_compose_refs = require("@tamagui/compose-refs");
37
37
  var import_constants = require("@tamagui/constants");
38
38
  var import_core = require("@tamagui/core");
39
39
  var import_helpers = require("@tamagui/helpers");
40
- __toESM(require("react"), 1);
40
+ var React = __toESM(require("react"), 1);
41
41
  var import_context = require("./context.native.js");
42
42
  var SelectTriggerFrame = (0, import_core.styled)(import_core.View, {
43
43
  displayName: "SelectTrigger",
@@ -51,6 +51,7 @@ var SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, functio
51
51
  var context = (0, import_context.useSelectContext)(scope);
52
52
  var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
53
53
  var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);
54
+ var pressIsTouch = React.useRef(false);
54
55
  if (itemParentContext.shouldRenderWebNative) return null;
55
56
  var toggleOpen = function(event) {
56
57
  var reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "trigger-press";
@@ -58,10 +59,19 @@ var SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, functio
58
59
  };
59
60
  var interactionProps = {
60
61
  ...triggerProps,
61
- ...import_constants.isWeb ? { onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {
62
- event.preventDefault();
63
- toggleOpen(event);
64
- }) } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
62
+ ...import_constants.isWeb ? {
63
+ onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {
64
+ pressIsTouch.current = event.type === "touchstart";
65
+ if (pressIsTouch.current) return;
66
+ event.preventDefault();
67
+ toggleOpen(event);
68
+ }),
69
+ onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, function(event) {
70
+ if (!pressIsTouch.current) return;
71
+ pressIsTouch.current = false;
72
+ toggleOpen(event);
73
+ })
74
+ } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },
65
75
  onKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, function(event) {
66
76
  if (event.key === "Enter" || event.key === " ") {
67
77
  event.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTrigger.native.js","names":[],"sources":["cjs/SelectTrigger.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SelectTrigger_exports = {};\n__export(SelectTrigger_exports, {\n\tSelectTrigger: () => SelectTrigger,\n\tSelectTriggerFrame: () => SelectTriggerFrame\n});\nmodule.exports = __toCommonJS(SelectTrigger_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\n__toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar SelectTriggerFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"SelectTrigger\",\n\talignItems: \"center\",\n\tflexDirection: \"row\",\n\trender: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", { type: \"button\" })\n});\nvar SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, function SelectTrigger2(props, forwardedRef) {\n\tvar _context_floatingContext;\n\tvar { scope, disabled = false, ...triggerProps } = props;\n\tvar context = (0, import_context.useSelectContext)(scope);\n\tvar itemParentContext = (0, import_context.useSelectItemParentContext)(scope);\n\tvar composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);\n\tif (itemParentContext.shouldRenderWebNative) return null;\n\tvar toggleOpen = function(event) {\n\t\tvar reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"trigger-press\";\n\t\tif (!disabled) itemParentContext.requestOpenChange(!context.open, (0, import_core.createChangeEventDetails)(reason, (event === null || event === void 0 ? void 0 : event.nativeEvent) || event, event === null || event === void 0 ? void 0 : event.currentTarget));\n\t};\n\tvar interactionProps = {\n\t\t...triggerProps,\n\t\t...import_constants.isWeb ? { onMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {\n\t\t\tevent.preventDefault();\n\t\t\ttoggleOpen(event);\n\t\t}) } : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },\n\t\tonKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, function(event) {\n\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleOpen(event, \"keyboard\");\n\t\t\t}\n\t\t})\n\t};\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTriggerFrame, {\n\t\ttype: \"button\",\n\t\tid: itemParentContext.id,\n\t\trole: \"combobox\",\n\t\t\"aria-haspopup\": \"listbox\",\n\t\t\"aria-expanded\": context.open,\n\t\t\"aria-autocomplete\": \"none\",\n\t\taccessibilityRole: import_constants.isWeb ? void 0 : \"button\",\n\t\taccessibilityState: import_constants.isWeb ? void 0 : {\n\t\t\texpanded: context.open,\n\t\t\tdisabled\n\t\t},\n\t\tdir: context.dir,\n\t\tdisabled,\n\t\t\"data-disabled\": disabled ? \"\" : void 0,\n\t\t...interactionProps,\n\t\tref: composedRefs\n\t});\n});\n//# sourceMappingURL=SelectTrigger.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC/B,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;AACF;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC7C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EACnE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QAAQ,UAAU,IAAI,KAAK;GAC9G,WAAW,KAAK;GAChB,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAC3D,CAAC;CACF;CACA,OAAO;AACR;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKpG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CACpE,OAAO;CACP,YAAY;AACb,CAAC,IAAI,QACL,GACD;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB;CAC/B,qBAAqB;CACrB,0BAA0B;AAC3B,CAAC;AACD,OAAO,UAAU,aAAa,qBAAqB;AACnD,IAAI,qBAAqB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,eAAe,qBAAoB,CAAE,aAAa,aAAa,SAAS,OAAO;GAC7H,MAAM,eAAe;GACrB,WAAW,KAAK;EACjB,CAAC,EAAE,IAAI,EAAE,UAAU,GAAG,eAAe,qBAAoB,CAAE,aAAa,SAAS,UAAU,EAAE;EAC7F,YAAY,GAAG,eAAe,qBAAoB,CAAE,aAAa,WAAW,SAAS,OAAO;GAC3F,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;IAC/C,MAAM,eAAe;IACrB,WAAW,OAAO,UAAU;GAC7B;EACD,CAAC;CACF;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB;EACtE,MAAM;EACN,IAAI,kBAAkB;EACtB,MAAM;EACN,iBAAiB;EACjB,iBAAiB,QAAQ;EACzB,qBAAqB;EACrB,mBAAmB,iBAAiB,QAAQ,KAAK,IAAI;EACrD,oBAAoB,iBAAiB,QAAQ,KAAK,IAAI;GACrD,UAAU,QAAQ;GAClB;EACD;EACA,KAAK,QAAQ;EACb;EACA,iBAAiB,WAAW,KAAK,KAAK;EACtC,GAAG;EACH,KAAK;CACN,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"SelectTrigger.native.js","names":[],"sources":["cjs/SelectTrigger.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SelectTrigger_exports = {};\n__export(SelectTrigger_exports, {\n\tSelectTrigger: () => SelectTrigger,\n\tSelectTriggerFrame: () => SelectTriggerFrame\n});\nmodule.exports = __toCommonJS(SelectTrigger_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar SelectTriggerFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"SelectTrigger\",\n\talignItems: \"center\",\n\tflexDirection: \"row\",\n\trender: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", { type: \"button\" })\n});\nvar SelectTrigger = (0, import_core.createStyledHOC)(SelectTriggerFrame, function SelectTrigger2(props, forwardedRef) {\n\tvar _context_floatingContext;\n\tvar { scope, disabled = false, ...triggerProps } = props;\n\tvar context = (0, import_context.useSelectContext)(scope);\n\tvar itemParentContext = (0, import_context.useSelectItemParentContext)(scope);\n\tvar composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);\n\tvar pressIsTouch = React.useRef(false);\n\tif (itemParentContext.shouldRenderWebNative) return null;\n\tvar toggleOpen = function(event) {\n\t\tvar reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"trigger-press\";\n\t\tif (!disabled) itemParentContext.requestOpenChange(!context.open, (0, import_core.createChangeEventDetails)(reason, (event === null || event === void 0 ? void 0 : event.nativeEvent) || event, event === null || event === void 0 ? void 0 : event.currentTarget));\n\t};\n\tvar interactionProps = {\n\t\t...triggerProps,\n\t\t...import_constants.isWeb ? {\n\t\t\tonMouseDown: (0, import_helpers.composeEventHandlers)(triggerProps.onMouseDown, function(event) {\n\t\t\t\tpressIsTouch.current = event.type === \"touchstart\";\n\t\t\t\tif (pressIsTouch.current) return;\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleOpen(event);\n\t\t\t}),\n\t\t\tonPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, function(event) {\n\t\t\t\tif (!pressIsTouch.current) return;\n\t\t\t\tpressIsTouch.current = false;\n\t\t\t\ttoggleOpen(event);\n\t\t\t})\n\t\t} : { onPress: (0, import_helpers.composeEventHandlers)(triggerProps.onPress, toggleOpen) },\n\t\tonKeyDown: (0, import_helpers.composeEventHandlers)(triggerProps.onKeyDown, function(event) {\n\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleOpen(event, \"keyboard\");\n\t\t\t}\n\t\t})\n\t};\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTriggerFrame, {\n\t\ttype: \"button\",\n\t\tid: itemParentContext.id,\n\t\trole: \"combobox\",\n\t\t\"aria-haspopup\": \"listbox\",\n\t\t\"aria-expanded\": context.open,\n\t\t\"aria-autocomplete\": \"none\",\n\t\taccessibilityRole: import_constants.isWeb ? void 0 : \"button\",\n\t\taccessibilityState: import_constants.isWeb ? void 0 : {\n\t\t\texpanded: context.open,\n\t\t\tdisabled\n\t\t},\n\t\tdir: context.dir,\n\t\tdisabled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,qBAAoB,CAAE,aAAa,aAAa,SAAS,OAAO;IAC/F,aAAa,UAAU,MAAM,SAAS;IACtC,IAAI,aAAa,SAAS;IAC1B,MAAM,eAAe;IACrB,WAAW,KAAK;GACjB,CAAC;GACD,UAAU,GAAG,eAAe,qBAAoB,CAAE,aAAa,SAAS,SAAS,OAAO;IACvF,IAAI,CAAC,aAAa,SAAS;IAC3B,aAAa,UAAU;IACvB,WAAW,KAAK;GACjB,CAAC;EACF,IAAI,EAAE,UAAU,GAAG,eAAe,qBAAoB,CAAE,aAAa,SAAS,UAAU,EAAE;EAC1F,YAAY,GAAG,eAAe,qBAAoB,CAAE,aAAa,WAAW,SAAS,OAAO;GAC3F,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;IAC/C,MAAM,eAAe;IACrB,WAAW,OAAO,UAAU;GAC7B;EACD,CAAC;CACF;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB;EACtE,MAAM;EACN,IAAI,kBAAkB;EACtB,MAAM;EACN,iBAAiB;EACjB,iBAAiB,QAAQ;EACzB,qBAAqB;EACrB,mBAAmB,iBAAiB,QAAQ,KAAK,IAAI;EACrD,oBAAoB,iBAAiB,QAAQ,KAAK,IAAI;GACrD,UAAU,QAAQ;GAClB;EACD;EACA,KAAK,QAAQ;EACb;EACA,iBAAiB,WAAW,KAAK,KAAK;EACtC,GAAG;EACH,KAAK;CACN,CAAC;AACF,CAAC"}
@@ -37,7 +37,6 @@ var import_constants = require("@tamagui/constants");
37
37
  var import_core = require("@tamagui/core");
38
38
  var import_portal = require("@tamagui/portal");
39
39
  var import_stacks = require("@tamagui/stacks");
40
- var import_start_transition = require("@tamagui/start-transition");
41
40
  var React = __toESM(require("react"), 1);
42
41
  var import_constants2 = require("./constants.cjs");
43
42
  var import_context = require("./context.cjs");
@@ -48,6 +47,10 @@ const SelectViewportFrame = (0, import_core.styled)(import_core.View, {
48
47
  position: "relative"
49
48
  });
50
49
  const needsRepropagation = (0, import_portal.needsPortalRepropagation)();
50
+ const getSheetFrameProps = (props) => {
51
+ const { className, style, "data-tamagui-hoc-class": _hocClassNames, ...rest } = props;
52
+ return (0, import_core.splitStyleProps)(rest)[1];
53
+ };
51
54
  const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {
52
55
  const { scope, children, disableScroll, ...viewportProps } = props;
53
56
  const context = (0, import_context.useSelectContext)(scope);
@@ -55,19 +58,9 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
55
58
  const isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
56
59
  const viewportRef = React.useRef(null);
57
60
  const registeredItemCount = itemContext.registry.getItems().length;
58
- const [lazyMounted, setLazyMounted] = React.useState(context.lazyMount ? false : true);
59
- React.useEffect(() => {
60
- if (!context.lazyMount) return;
61
- if (!context.open) return;
62
- if (lazyMounted) return;
63
- (0, import_start_transition.startTransition)(() => {
64
- setLazyMounted(true);
65
- });
66
- }, [
67
- context.lazyMount,
68
- context.open,
69
- lazyMounted
70
- ]);
61
+ const hasOpenedRef = React.useRef(!context.lazyMount);
62
+ if (context.open) hasOpenedRef.current = true;
63
+ const lazyMounted = hasOpenedRef.current;
71
64
  React.useEffect(() => {
72
65
  if (!import_constants.isWeb || !isAdapted || !context.open) return;
73
66
  const frame = requestAnimationFrame(() => {
@@ -77,7 +70,6 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
77
70
  });
78
71
  return () => cancelAnimationFrame(frame);
79
72
  }, [
80
- context.activeIndex,
81
73
  context.open,
82
74
  isAdapted,
83
75
  registeredItemCount
@@ -89,11 +81,11 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
89
81
  }
90
82
  }, [isAdapted]);
91
83
  React.useEffect(() => {
92
- if (context.lazyMount && lazyMounted && context.open && context.update) {
84
+ if (context.lazyMount && context.open && context.update) {
93
85
  const frame = requestAnimationFrame(context.update);
94
86
  return () => cancelAnimationFrame(frame);
95
87
  }
96
- }, [lazyMounted, registeredItemCount]);
88
+ }, [context.open, registeredItemCount]);
97
89
  if (itemContext.shouldRenderWebNative) {
98
90
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {
99
91
  position: "relative",
@@ -101,8 +93,9 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
101
93
  });
102
94
  }
103
95
  if (isAdapted || !import_constants.isWeb) {
96
+ const frameProps = isAdapted ? getSheetFrameProps(viewportProps) : viewportProps;
104
97
  let content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
105
- ...viewportProps,
98
+ ...frameProps,
106
99
  ...import_constants.isWeb ? (0, import_selectionController.getSelectListboxProps)(itemContext.mode) : {},
107
100
  "data-select-viewport": "",
108
101
  ref: composedRefs,
@@ -120,23 +113,27 @@ const SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, fun
120
113
  children: content
121
114
  });
122
115
  }
123
- if (!itemContext.interactions) {
116
+ if (!context.interactions) {
124
117
  return null;
125
118
  }
126
- const { style, className, ...floatingProps } = itemContext.interactions.getFloatingProps();
119
+ const floatingProps = context.interactions.getFloatingProps();
127
120
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
128
121
  !disableScroll && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { dangerouslySetInnerHTML: { __html: selectViewportCSS } }),
129
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, { children: context.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
130
- "data-select-viewport": "",
131
- ...import_constants.isWeb && { "data-state": context.open ? "open" : "closed" },
132
- ...viewportProps,
133
- ...style,
134
- ...floatingProps,
135
- ...(0, import_selectionController.getSelectListboxProps)(itemContext.mode),
136
- overflowY: disableScroll ? void 0 : style.overflow ?? "auto",
137
- ref: composedRefs,
138
- children: lazyMounted ? children : null
139
- }, "select-viewport") : null }),
122
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
123
+ presenceAffectsLayout: false,
124
+ children: context.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
125
+ "data-select-viewport": "",
126
+ ...import_constants.isWeb && { "data-state": context.open ? "open" : "closed" },
127
+ ...viewportProps,
128
+ ...context.floatingPosition,
129
+ outlineWidth: 0,
130
+ ...floatingProps,
131
+ ...(0, import_selectionController.getSelectListboxProps)(itemContext.mode),
132
+ overflowY: disableScroll ? void 0 : "auto",
133
+ ref: composedRefs,
134
+ children: lazyMounted ? children : null
135
+ }, "select-viewport") : null
136
+ }),
140
137
  !context.open && !(context.lazyMount && context.renderValue) && lazyMounted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
141
138
  style: { display: "none" },
142
139
  children
@@ -147,7 +144,7 @@ const selectViewportCSS = `
147
144
  [data-select-viewport] {
148
145
  scrollbar-width: none;
149
146
  -webkit-overflow-scrolling: touch;
150
- overscroll-behavior: contain;
147
+ overscroll-behavior: none;
151
148
  }
152
149
 
153
150
  [data-select-viewport]::-webkit-scrollbar{
@@ -40,14 +40,14 @@ var SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, funct
40
40
  var context = (0, import_context.useSelectContext)(scope);
41
41
  var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
42
42
  var themeName = (0, import_core.useThemeName)();
43
- var adaptContext = (0, import_adapt.useAdaptContext)();
43
+ var adaptContext = (0, import_adapt.useAdaptContext)(context.adaptScope);
44
44
  var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
45
45
  var contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
46
46
  name: themeName,
47
47
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {
48
48
  itemContext: itemParentContext,
49
49
  context,
50
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptContext.Provider, {
50
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.ProvideAdaptContext, {
51
51
  ...adaptContext,
52
52
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
53
53
  ...viewportProps,
@@ -40,14 +40,14 @@ var SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, funct
40
40
  var context = (0, import_context.useSelectContext)(scope);
41
41
  var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
42
42
  var themeName = (0, import_core.useThemeName)();
43
- var adaptContext = (0, import_adapt.useAdaptContext)();
43
+ var adaptContext = (0, import_adapt.useAdaptContext)(context.adaptScope);
44
44
  var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
45
45
  var contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
46
46
  name: themeName,
47
47
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {
48
48
  itemContext: itemParentContext,
49
49
  context,
50
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptContext.Provider, {
50
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.ProvideAdaptContext, {
51
51
  ...adaptContext,
52
52
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
53
53
  ...viewportProps,
@@ -1 +1 @@
1
- {"version":3,"file":"SelectViewport.native.js","names":[],"sources":["cjs/SelectViewport.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 SelectViewport_native_exports = {};\n__export(SelectViewport_native_exports, {\n SelectViewport: () => SelectViewport,\n SelectViewportFrame: () => SelectViewportFrame\n});\nmodule.exports = __toCommonJS(SelectViewport_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_adapt = require(\"@tamagui/adapt\");\nvar import_core = require(\"@tamagui/core\");\nvar import_constants = require(\"./constants\");\nvar import_context = require(\"./context\");\nvar SelectViewportFrame = (0, import_core.styled)(import_core.View, {\n displayName: import_constants.VIEWPORT_NAME,\n position: \"relative\"\n});\nvar SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {\n var { scope, children, disableScroll: _disableScroll, ...viewportProps } = props;\n var context = (0, import_context.useSelectContext)(scope);\n var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);\n var themeName = (0, import_core.useThemeName)();\n var adaptContext = (0, import_adapt.useAdaptContext)();\n var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);\n var contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {\n name: themeName,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {\n itemContext: itemParentContext,\n context,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptContext.Provider, {\n ...adaptContext,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {\n ...viewportProps,\n ref: forwardedRef,\n children\n })\n })\n })\n });\n if (!context.open) {\n if (context.lazyMount && context.renderValue) return null;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {\n display: \"none\",\n children: contents\n });\n }\n return isAdapted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptPortalContents, {\n scope: context.adaptScope,\n children: contents\n }) : contents;\n});\nSelectViewport.displayName = import_constants.VIEWPORT_NAME;\n//# sourceMappingURL=SelectViewport.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,gCAAgC,CAAC;AACrC,SAAS,+BAA+B;CACtC,sBAAsB;CACtB,2BAA2B;AAC7B,CAAC;AACD,OAAO,UAAU,aAAa,6BAA6B;AAC3D,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,eAAe,QAAQ,gBAAgB;AAC3C,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,mBAAmB,QAAQ,uBAAa;AAC5C,IAAI,iBAAiB,QAAQ,qBAAW;AACxC,IAAI,uBAAuB,GAAG,YAAY,OAAM,CAAE,YAAY,MAAM;CAClE,aAAa,iBAAiB;CAC9B,UAAU;AACZ,CAAC;AACD,IAAI,kBAAkB,GAAG,YAAY,gBAAe,CAAE,qBAAqB,SAAS,gBAAgB,OAAO,cAAc;CACvH,IAAI,EAAE,OAAO,UAAU,eAAe,gBAAgB,GAAG,kBAAkB;CAC3E,IAAI,WAAW,GAAG,eAAe,iBAAgB,CAAE,KAAK;CACxD,IAAI,qBAAqB,GAAG,eAAe,2BAA0B,CAAE,KAAK;CAC5E,IAAI,aAAa,GAAG,YAAY,aAAY,CAAE;CAC9C,IAAI,gBAAgB,GAAG,aAAa,gBAAe,CAAE;CACrD,IAAI,aAAa,GAAG,aAAa,iBAAgB,CAAE,QAAQ,UAAU;CACrE,IAAI,WAA2B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,YAAY,OAAO;EAC5E,MAAM;EACN,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,eAAe,sBAAsB;GACzF,aAAa;GACb;GACA,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa,aAAa,UAAU;IACxF,GAAG;IACH,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB;KACzE,GAAG;KACH,KAAK;KACL;IACF,CAAC;GACH,CAAC;EACH,CAAC;CACH,CAAC;CACD,IAAI,CAAC,QAAQ,MAAM;EACjB,IAAI,QAAQ,aAAa,QAAQ,aAAa,OAAO;EACrD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB;GACtE,SAAS;GACT,UAAU;EACZ,CAAC;CACH;CACA,OAAO,YAA4B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa,qBAAqB;EAC/F,OAAO,QAAQ;EACf,UAAU;CACZ,CAAC,IAAI;AACP,CAAC;AACD,eAAe,cAAc,iBAAiB"}
1
+ {"version":3,"file":"SelectViewport.native.js","names":[],"sources":["cjs/SelectViewport.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 SelectViewport_native_exports = {};\n__export(SelectViewport_native_exports, {\n SelectViewport: () => SelectViewport,\n SelectViewportFrame: () => SelectViewportFrame\n});\nmodule.exports = __toCommonJS(SelectViewport_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_adapt = require(\"@tamagui/adapt\");\nvar import_core = require(\"@tamagui/core\");\nvar import_constants = require(\"./constants\");\nvar import_context = require(\"./context\");\nvar SelectViewportFrame = (0, import_core.styled)(import_core.View, {\n displayName: import_constants.VIEWPORT_NAME,\n position: \"relative\"\n});\nvar SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {\n var { scope, children, disableScroll: _disableScroll, ...viewportProps } = props;\n var context = (0, import_context.useSelectContext)(scope);\n var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);\n var themeName = (0, import_core.useThemeName)();\n var adaptContext = (0, import_adapt.useAdaptContext)(context.adaptScope);\n var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);\n var contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {\n name: themeName,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {\n itemContext: itemParentContext,\n context,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.ProvideAdaptContext, {\n ...adaptContext,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {\n ...viewportProps,\n ref: forwardedRef,\n children\n })\n })\n })\n });\n if (!context.open) {\n if (context.lazyMount && context.renderValue) return null;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {\n display: \"none\",\n children: contents\n });\n }\n return isAdapted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptPortalContents, {\n scope: context.adaptScope,\n children: contents\n }) : contents;\n});\nSelectViewport.displayName = import_constants.VIEWPORT_NAME;\n//# sourceMappingURL=SelectViewport.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,gCAAgC,CAAC;AACrC,SAAS,+BAA+B;CACtC,sBAAsB;CACtB,2BAA2B;AAC7B,CAAC;AACD,OAAO,UAAU,aAAa,6BAA6B;AAC3D,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,eAAe,QAAQ,gBAAgB;AA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,CAAC,IAAI;AACP,CAAC;AACD,eAAe,cAAc,iBAAiB"}
@@ -47,13 +47,24 @@ function createSelectItemRegistry(onChange) {
47
47
  const explicitTextValues = /* @__PURE__ */ new Map();
48
48
  const itemNodes = /* @__PURE__ */ new Map();
49
49
  const listeners = /* @__PURE__ */ new Set();
50
+ let indexByValue = null;
50
51
  const notify = () => {
52
+ indexByValue = null;
51
53
  onChange?.();
52
54
  listeners.forEach((listener) => listener());
53
55
  };
54
56
  const getItems = () => items;
55
57
  const getItem = (value) => items.find((item) => item.value === value);
56
- const getIndex = (value) => items.findIndex((item) => item.value === value);
58
+ const getIndex = (value) => {
59
+ if (!indexByValue) {
60
+ indexByValue = /* @__PURE__ */ new Map();
61
+ items.forEach((item, index) => {
62
+ if (!indexByValue.has(item.value)) indexByValue.set(item.value, index);
63
+ });
64
+ }
65
+ return indexByValue.get(value) ?? -1;
66
+ };
67
+ const getNodes = () => items.map((item) => itemNodes.get(item.id) ?? null);
57
68
  const getRegisteredLabel = (value) => {
58
69
  const registrations = labelRegistrations.get(value);
59
70
  if (!registrations?.size) return void 0;
@@ -76,7 +87,6 @@ function createSelectItemRegistry(onChange) {
76
87
  if (changed) notify();
77
88
  };
78
89
  const syncNodeOrder = () => {
79
- const previousOrder = items.map((item) => item.id);
80
90
  items.sort((a, b) => {
81
91
  const aNode = itemNodes.get(a.id);
82
92
  const bNode = itemNodes.get(b.id);
@@ -88,9 +98,6 @@ function createSelectItemRegistry(onChange) {
88
98
  if (position & 2) return 1;
89
99
  return 0;
90
100
  });
91
- if (items.some((item, index) => item.id !== previousOrder[index])) {
92
- notify();
93
- }
94
101
  };
95
102
  const registerItem = (item) => {
96
103
  const id = Symbol(item.value);
@@ -130,12 +137,14 @@ function createSelectItemRegistry(onChange) {
130
137
  notify();
131
138
  },
132
139
  setNode(node) {
140
+ if ((itemNodes.get(id) ?? null) === (node ?? null)) return;
133
141
  if (node) {
134
142
  itemNodes.set(id, node);
135
143
  syncNodeOrder();
136
144
  } else {
137
145
  itemNodes.delete(id);
138
146
  }
147
+ notify();
139
148
  },
140
149
  unregister() {
141
150
  const index = items.findIndex((current) => current.id === id);
@@ -210,6 +219,7 @@ function createSelectItemRegistry(onChange) {
210
219
  getItems,
211
220
  getItem,
212
221
  getIndex,
222
+ getNodes,
213
223
  firstEnabledIndex,
214
224
  nextEnabledIndex,
215
225
  findTypeaheadIndex,
@@ -31,10 +31,6 @@ __export(selectionController_exports, {
31
31
  selectedValuesFromSelection: () => selectedValuesFromSelection
32
32
  });
33
33
  module.exports = __toCommonJS(selectionController_exports);
34
- function _type_of(obj) {
35
- "@swc/helpers - typeof";
36
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
37
- }
38
34
  function getSelectLabelText(label) {
39
35
  if (typeof label === "string" || typeof label === "number") {
40
36
  return String(label);
@@ -42,7 +38,7 @@ function getSelectLabelText(label) {
42
38
  if (Array.isArray(label)) {
43
39
  return label.map(getSelectLabelText).join("");
44
40
  }
45
- if (label && (typeof label === "undefined" ? "undefined" : _type_of(label)) === "object" && "props" in label) {
41
+ if (label && typeof label === "object" && "props" in label) {
46
42
  var _label_props;
47
43
  return getSelectLabelText((_label_props = label.props) === null || _label_props === void 0 ? void 0 : _label_props.children);
48
44
  }
@@ -54,7 +50,9 @@ function createSelectItemRegistry(onChange) {
54
50
  var explicitTextValues = /* @__PURE__ */ new Map();
55
51
  var itemNodes = /* @__PURE__ */ new Map();
56
52
  var listeners = /* @__PURE__ */ new Set();
53
+ var indexByValue = null;
57
54
  var notify = function() {
55
+ indexByValue = null;
58
56
  onChange === null || onChange === void 0 ? void 0 : onChange();
59
57
  listeners.forEach(function(listener) {
60
58
  return listener();
@@ -69,8 +67,19 @@ function createSelectItemRegistry(onChange) {
69
67
  });
70
68
  };
71
69
  var getIndex = function(value) {
72
- return items.findIndex(function(item) {
73
- return item.value === value;
70
+ if (!indexByValue) {
71
+ indexByValue = /* @__PURE__ */ new Map();
72
+ items.forEach(function(item, index) {
73
+ if (!indexByValue.has(item.value)) indexByValue.set(item.value, index);
74
+ });
75
+ }
76
+ var _indexByValue_get;
77
+ return (_indexByValue_get = indexByValue.get(value)) !== null && _indexByValue_get !== void 0 ? _indexByValue_get : -1;
78
+ };
79
+ var getNodes = function() {
80
+ return items.map(function(item) {
81
+ var _itemNodes_get;
82
+ return (_itemNodes_get = itemNodes.get(item.id)) !== null && _itemNodes_get !== void 0 ? _itemNodes_get : null;
74
83
  });
75
84
  };
76
85
  var getRegisteredLabel = function(value) {
@@ -112,9 +121,6 @@ function createSelectItemRegistry(onChange) {
112
121
  if (changed) notify();
113
122
  };
114
123
  var syncNodeOrder = function() {
115
- var previousOrder = items.map(function(item) {
116
- return item.id;
117
- });
118
124
  items.sort(function(a, b) {
119
125
  var aNode = itemNodes.get(a.id);
120
126
  var bNode = itemNodes.get(b.id);
@@ -126,11 +132,6 @@ function createSelectItemRegistry(onChange) {
126
132
  if (position & 2) return 1;
127
133
  return 0;
128
134
  });
129
- if (items.some(function(item, index) {
130
- return item.id !== previousOrder[index];
131
- })) {
132
- notify();
133
- }
134
135
  };
135
136
  var registerItem = function(item) {
136
137
  var id = Symbol(item.value);
@@ -176,12 +177,15 @@ function createSelectItemRegistry(onChange) {
176
177
  notify();
177
178
  },
178
179
  setNode(node) {
180
+ var _itemNodes_get;
181
+ if (((_itemNodes_get = itemNodes.get(id)) !== null && _itemNodes_get !== void 0 ? _itemNodes_get : null) === (node !== null && node !== void 0 ? node : null)) return;
179
182
  if (node) {
180
183
  itemNodes.set(id, node);
181
184
  syncNodeOrder();
182
185
  } else {
183
186
  itemNodes.delete(id);
184
187
  }
188
+ notify();
185
189
  },
186
190
  unregister() {
187
191
  var index = items.findIndex(function(current) {
@@ -264,6 +268,7 @@ function createSelectItemRegistry(onChange) {
264
268
  getItems,
265
269
  getItem,
266
270
  getIndex,
271
+ getNodes,
267
272
  firstEnabledIndex,
268
273
  nextEnabledIndex,
269
274
  findTypeaheadIndex,
@@ -31,10 +31,6 @@ __export(selectionController_exports, {
31
31
  selectedValuesFromSelection: () => selectedValuesFromSelection
32
32
  });
33
33
  module.exports = __toCommonJS(selectionController_exports);
34
- function _type_of(obj) {
35
- "@swc/helpers - typeof";
36
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
37
- }
38
34
  function getSelectLabelText(label) {
39
35
  if (typeof label === "string" || typeof label === "number") {
40
36
  return String(label);
@@ -42,7 +38,7 @@ function getSelectLabelText(label) {
42
38
  if (Array.isArray(label)) {
43
39
  return label.map(getSelectLabelText).join("");
44
40
  }
45
- if (label && (typeof label === "undefined" ? "undefined" : _type_of(label)) === "object" && "props" in label) {
41
+ if (label && typeof label === "object" && "props" in label) {
46
42
  var _label_props;
47
43
  return getSelectLabelText((_label_props = label.props) === null || _label_props === void 0 ? void 0 : _label_props.children);
48
44
  }
@@ -54,7 +50,9 @@ function createSelectItemRegistry(onChange) {
54
50
  var explicitTextValues = /* @__PURE__ */ new Map();
55
51
  var itemNodes = /* @__PURE__ */ new Map();
56
52
  var listeners = /* @__PURE__ */ new Set();
53
+ var indexByValue = null;
57
54
  var notify = function() {
55
+ indexByValue = null;
58
56
  onChange === null || onChange === void 0 ? void 0 : onChange();
59
57
  listeners.forEach(function(listener) {
60
58
  return listener();
@@ -69,8 +67,19 @@ function createSelectItemRegistry(onChange) {
69
67
  });
70
68
  };
71
69
  var getIndex = function(value) {
72
- return items.findIndex(function(item) {
73
- return item.value === value;
70
+ if (!indexByValue) {
71
+ indexByValue = /* @__PURE__ */ new Map();
72
+ items.forEach(function(item, index) {
73
+ if (!indexByValue.has(item.value)) indexByValue.set(item.value, index);
74
+ });
75
+ }
76
+ var _indexByValue_get;
77
+ return (_indexByValue_get = indexByValue.get(value)) !== null && _indexByValue_get !== void 0 ? _indexByValue_get : -1;
78
+ };
79
+ var getNodes = function() {
80
+ return items.map(function(item) {
81
+ var _itemNodes_get;
82
+ return (_itemNodes_get = itemNodes.get(item.id)) !== null && _itemNodes_get !== void 0 ? _itemNodes_get : null;
74
83
  });
75
84
  };
76
85
  var getRegisteredLabel = function(value) {
@@ -112,9 +121,6 @@ function createSelectItemRegistry(onChange) {
112
121
  if (changed) notify();
113
122
  };
114
123
  var syncNodeOrder = function() {
115
- var previousOrder = items.map(function(item) {
116
- return item.id;
117
- });
118
124
  items.sort(function(a, b) {
119
125
  var aNode = itemNodes.get(a.id);
120
126
  var bNode = itemNodes.get(b.id);
@@ -126,11 +132,6 @@ function createSelectItemRegistry(onChange) {
126
132
  if (position & 2) return 1;
127
133
  return 0;
128
134
  });
129
- if (items.some(function(item, index) {
130
- return item.id !== previousOrder[index];
131
- })) {
132
- notify();
133
- }
134
135
  };
135
136
  var registerItem = function(item) {
136
137
  var id = Symbol(item.value);
@@ -176,12 +177,15 @@ function createSelectItemRegistry(onChange) {
176
177
  notify();
177
178
  },
178
179
  setNode(node) {
180
+ var _itemNodes_get;
181
+ if (((_itemNodes_get = itemNodes.get(id)) !== null && _itemNodes_get !== void 0 ? _itemNodes_get : null) === (node !== null && node !== void 0 ? node : null)) return;
179
182
  if (node) {
180
183
  itemNodes.set(id, node);
181
184
  syncNodeOrder();
182
185
  } else {
183
186
  itemNodes.delete(id);
184
187
  }
188
+ notify();
185
189
  },
186
190
  unregister() {
187
191
  var index = items.findIndex(function(current) {
@@ -264,6 +268,7 @@ function createSelectItemRegistry(onChange) {
264
268
  getItems,
265
269
  getItem,
266
270
  getIndex,
271
+ getNodes,
267
272
  firstEnabledIndex,
268
273
  nextEnabledIndex,
269
274
  findTypeaheadIndex,