@tamagui/linear-gradient 1.0.11 → 1.0.12

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 (85) hide show
  1. package/package.json +4 -4
  2. package/dist/cjs/BubbleSelect.js +0 -44
  3. package/dist/cjs/BubbleSelect.js.map +0 -7
  4. package/dist/cjs/Select.js +0 -480
  5. package/dist/cjs/Select.js.map +0 -7
  6. package/dist/cjs/SelectContent.js +0 -76
  7. package/dist/cjs/SelectContent.js.map +0 -7
  8. package/dist/cjs/SelectContent.native.js +0 -31
  9. package/dist/cjs/SelectContent.native.js.map +0 -7
  10. package/dist/cjs/SelectImpl.js +0 -301
  11. package/dist/cjs/SelectImpl.js.map +0 -7
  12. package/dist/cjs/SelectImpl.native.js +0 -37
  13. package/dist/cjs/SelectImpl.native.js.map +0 -7
  14. package/dist/cjs/SelectScrollButton.js +0 -161
  15. package/dist/cjs/SelectScrollButton.js.map +0 -7
  16. package/dist/cjs/SelectScrollButton.native.js +0 -32
  17. package/dist/cjs/SelectScrollButton.native.js.map +0 -7
  18. package/dist/cjs/SelectViewport.js +0 -126
  19. package/dist/cjs/SelectViewport.js.map +0 -7
  20. package/dist/cjs/SelectViewport.native.js +0 -62
  21. package/dist/cjs/SelectViewport.native.js.map +0 -7
  22. package/dist/cjs/constants.js +0 -47
  23. package/dist/cjs/constants.js.map +0 -7
  24. package/dist/cjs/context.js +0 -49
  25. package/dist/cjs/context.js.map +0 -7
  26. package/dist/cjs/types.js +0 -17
  27. package/dist/cjs/types.js.map +0 -7
  28. package/dist/cjs/useSelectBreakpointActive.js +0 -39
  29. package/dist/cjs/useSelectBreakpointActive.js.map +0 -7
  30. package/dist/esm/BubbleSelect.js +0 -25
  31. package/dist/esm/BubbleSelect.js.map +0 -7
  32. package/dist/esm/Select.js +0 -452
  33. package/dist/esm/Select.js.map +0 -7
  34. package/dist/esm/SelectContent.js +0 -52
  35. package/dist/esm/SelectContent.js.map +0 -7
  36. package/dist/esm/SelectContent.native.js +0 -7
  37. package/dist/esm/SelectContent.native.js.map +0 -7
  38. package/dist/esm/SelectImpl.js +0 -286
  39. package/dist/esm/SelectImpl.js.map +0 -7
  40. package/dist/esm/SelectImpl.native.js +0 -13
  41. package/dist/esm/SelectImpl.native.js.map +0 -7
  42. package/dist/esm/SelectScrollButton.js +0 -130
  43. package/dist/esm/SelectScrollButton.js.map +0 -7
  44. package/dist/esm/SelectScrollButton.native.js +0 -7
  45. package/dist/esm/SelectScrollButton.native.js.map +0 -7
  46. package/dist/esm/SelectViewport.js +0 -95
  47. package/dist/esm/SelectViewport.js.map +0 -7
  48. package/dist/esm/SelectViewport.native.js +0 -32
  49. package/dist/esm/SelectViewport.native.js.map +0 -7
  50. package/dist/esm/constants.js +0 -17
  51. package/dist/esm/constants.js.map +0 -7
  52. package/dist/esm/context.js +0 -21
  53. package/dist/esm/context.js.map +0 -7
  54. package/dist/esm/types.js +0 -1
  55. package/dist/esm/types.js.map +0 -7
  56. package/dist/esm/useSelectBreakpointActive.js +0 -14
  57. package/dist/esm/useSelectBreakpointActive.js.map +0 -7
  58. package/dist/jsx/BubbleSelect.js +0 -25
  59. package/dist/jsx/BubbleSelect.js.map +0 -7
  60. package/dist/jsx/Select.js +0 -326
  61. package/dist/jsx/Select.js.map +0 -7
  62. package/dist/jsx/SelectContent.js +0 -30
  63. package/dist/jsx/SelectContent.js.map +0 -7
  64. package/dist/jsx/SelectContent.native.js +0 -7
  65. package/dist/jsx/SelectContent.native.js.map +0 -7
  66. package/dist/jsx/SelectImpl.js +0 -259
  67. package/dist/jsx/SelectImpl.js.map +0 -7
  68. package/dist/jsx/SelectImpl.native.js +0 -10
  69. package/dist/jsx/SelectImpl.native.js.map +0 -7
  70. package/dist/jsx/SelectScrollButton.js +0 -103
  71. package/dist/jsx/SelectScrollButton.js.map +0 -7
  72. package/dist/jsx/SelectScrollButton.native.js +0 -7
  73. package/dist/jsx/SelectScrollButton.native.js.map +0 -7
  74. package/dist/jsx/SelectViewport.js +0 -73
  75. package/dist/jsx/SelectViewport.js.map +0 -7
  76. package/dist/jsx/SelectViewport.native.js +0 -18
  77. package/dist/jsx/SelectViewport.native.js.map +0 -7
  78. package/dist/jsx/constants.js +0 -17
  79. package/dist/jsx/constants.js.map +0 -7
  80. package/dist/jsx/context.js +0 -15
  81. package/dist/jsx/context.js.map +0 -7
  82. package/dist/jsx/types.js +0 -1
  83. package/dist/jsx/types.js.map +0 -7
  84. package/dist/jsx/useSelectBreakpointActive.js +0 -14
  85. package/dist/jsx/useSelectBreakpointActive.js.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/linear-gradient",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -23,15 +23,15 @@
23
23
  "lint:fix": "../../node_modules/.bin/rome check --apply-suggested src"
24
24
  },
25
25
  "dependencies": {
26
- "@tamagui/core": "^1.0.11",
27
- "@tamagui/stacks": "^1.0.11"
26
+ "@tamagui/core": "^1.0.12",
27
+ "@tamagui/stacks": "^1.0.12"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": "*",
31
31
  "react-dom": "*"
32
32
  },
33
33
  "devDependencies": {
34
- "@tamagui/build": "^1.0.11",
34
+ "@tamagui/build": "^1.0.12",
35
35
  "expo-linear-gradient": "^12.0.1",
36
36
  "react": "^18.2.0",
37
37
  "react-dom": "^18.2.0"
@@ -1,44 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
- mod
19
- ));
20
- var import_react_use_previous = require("@radix-ui/react-use-previous");
21
- var import_compose_refs = require("@tamagui/compose-refs");
22
- var React = __toESM(require("react"));
23
- const BubbleSelect = React.forwardRef((props, forwardedRef) => {
24
- const { value, ...selectProps } = props;
25
- const ref = React.useRef(null);
26
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
27
- const prevValue = (0, import_react_use_previous.usePrevious)(value);
28
- React.useEffect(() => {
29
- const select = ref.current;
30
- const selectProto = window.HTMLSelectElement.prototype;
31
- const descriptor = Object.getOwnPropertyDescriptor(
32
- selectProto,
33
- "value"
34
- );
35
- const setValue = descriptor.set;
36
- if (prevValue !== value && setValue) {
37
- const event = new Event("change", { bubbles: true });
38
- setValue.call(select, value);
39
- select.dispatchEvent(event);
40
- }
41
- }, [prevValue, value]);
42
- return null;
43
- });
44
- //# sourceMappingURL=BubbleSelect.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/BubbleSelect.tsx"],
4
- "sourcesContent": ["import { usePrevious } from '@radix-ui/react-use-previous'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\n/* -----------------------------------------------------------------------------------------------*/\nconst BubbleSelect = React.forwardRef<\n HTMLSelectElement,\n React.ComponentPropsWithoutRef<'select'>\n>((props, forwardedRef) => {\n const { value, ...selectProps } = props\n const ref = React.useRef<HTMLSelectElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const prevValue = usePrevious(value)\n\n // Bubble value change to parents (e.g form change event)\n React.useEffect(() => {\n const select = ref.current!\n const selectProto = window.HTMLSelectElement.prototype\n const descriptor = Object.getOwnPropertyDescriptor(\n selectProto,\n 'value',\n ) as PropertyDescriptor\n const setValue = descriptor.set\n if (prevValue !== value && setValue) {\n const event = new Event('change', { bubbles: true })\n setValue.call(select, value)\n select.dispatchEvent(event)\n }\n }, [prevValue, value])\n\n /**\n * We purposefully use a `select` here to support form autofill as much\n * as possible.\n *\n * We purposefully do not add the `value` attribute here to allow the value\n * to be set programatically and bubble to any parent form `onChange` event.\n * Adding the `value` will cause React to consider the programatic\n * dispatch a duplicate and it will get swallowed.\n *\n * We use `VisuallyHidden` rather than `display: \"none\"` because Safari autofill\n * won't work otherwise.\n */\n // TODO\n return null\n // return (\n // <VisuallyHidden asChild>\n // <select {...selectProps} ref={composedRefs} defaultValue={value} />\n // </VisuallyHidden>\n // )\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA,gCAA4B;AAC5B,0BAAgC;AAChC,YAAuB;AAGvB,MAAM,eAAe,MAAM,WAGzB,CAAC,OAAO,iBAAiB;AACzB,QAAM,EAAE,UAAU,YAAY,IAAI;AAClC,QAAM,MAAM,MAAM,OAA0B,IAAI;AAChD,QAAM,mBAAe,qCAAgB,cAAc,GAAG;AACtD,QAAM,gBAAY,uCAAY,KAAK;AAGnC,QAAM,UAAU,MAAM;AACpB,UAAM,SAAS,IAAI;AACnB,UAAM,cAAc,OAAO,kBAAkB;AAC7C,UAAM,aAAa,OAAO;AAAA,MACxB;AAAA,MACA;AAAA,IACF;AACA,UAAM,WAAW,WAAW;AAC5B,QAAI,cAAc,SAAS,UAAU;AACnC,YAAM,QAAQ,IAAI,MAAM,UAAU,EAAE,SAAS,KAAK,CAAC;AACnD,eAAS,KAAK,QAAQ,KAAK;AAC3B,aAAO,cAAc,KAAK;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,WAAW,KAAK,CAAC;AAerB,SAAO;AAMT,CAAC;",
6
- "names": []
7
- }
@@ -1,480 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
- var Select_exports = {};
26
- __export(Select_exports, {
27
- Select: () => Select,
28
- SelectGroupFrame: () => SelectGroupFrame,
29
- SelectIcon: () => SelectIcon,
30
- SelectItem: () => SelectItem,
31
- SelectItemTextFrame: () => SelectItemTextFrame,
32
- SelectSeparator: () => SelectSeparator,
33
- SelectTrigger: () => SelectTrigger
34
- });
35
- module.exports = __toCommonJS(Select_exports);
36
- var import_jsx_runtime = require("react/jsx-runtime");
37
- var import_adapt = require("@tamagui/adapt");
38
- var import_compose_refs = require("@tamagui/compose-refs");
39
- var import_core = require("@tamagui/core");
40
- var import_core2 = require("@tamagui/core");
41
- var import_core3 = require("@tamagui/core");
42
- var import_list_item = require("@tamagui/list-item");
43
- var import_portal = require("@tamagui/portal");
44
- var import_separator = require("@tamagui/separator");
45
- var import_sheet = require("@tamagui/sheet");
46
- var import_stacks = require("@tamagui/stacks");
47
- var import_text = require("@tamagui/text");
48
- var import_use_controllable_state = require("@tamagui/use-controllable-state");
49
- var React = __toESM(require("react"));
50
- var import_constants = require("./constants");
51
- var import_context = require("./context");
52
- var import_SelectContent = require("./SelectContent");
53
- var import_SelectImpl = require("./SelectImpl");
54
- var import_SelectScrollButton = require("./SelectScrollButton");
55
- var import_SelectViewport = require("./SelectViewport");
56
- var import_useSelectBreakpointActive = require("./useSelectBreakpointActive");
57
- const TRIGGER_NAME = "SelectTrigger";
58
- const SelectTrigger = React.forwardRef(
59
- (props, forwardedRef) => {
60
- const {
61
- __scopeSelect,
62
- disabled = false,
63
- "aria-labelledby": ariaLabelledby,
64
- ...triggerProps
65
- } = props;
66
- const context = (0, import_context.useSelectContext)(TRIGGER_NAME, __scopeSelect);
67
- const labelledBy = ariaLabelledby;
68
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItem, {
69
- componentName: TRIGGER_NAME,
70
- backgrounded: true,
71
- radiused: true,
72
- hoverTheme: true,
73
- pressTheme: true,
74
- focusTheme: true,
75
- focusable: true,
76
- borderWidth: 1,
77
- size: context.size,
78
- "aria-expanded": context.open,
79
- "aria-autocomplete": "none",
80
- "aria-labelledby": labelledBy,
81
- dir: context.dir,
82
- disabled,
83
- "data-disabled": disabled ? "" : void 0,
84
- ...triggerProps,
85
- ref: forwardedRef,
86
- ...process.env.TAMAGUI_TARGET === "web" && context.interactions ? context.interactions.getReferenceProps() : {
87
- onPress() {
88
- context.setOpen(!context.open);
89
- }
90
- }
91
- });
92
- }
93
- );
94
- SelectTrigger.displayName = TRIGGER_NAME;
95
- const VALUE_NAME = "SelectValue";
96
- const SelectValueFrame = (0, import_core2.styled)(import_text.Paragraph, {
97
- name: VALUE_NAME,
98
- selectable: false
99
- });
100
- const SelectValue = SelectValueFrame.extractable(
101
- React.forwardRef(
102
- ({
103
- __scopeSelect,
104
- children: childrenProp,
105
- placeholder
106
- }, forwardedRef) => {
107
- const context = (0, import_context.useSelectContext)(VALUE_NAME, __scopeSelect);
108
- const { onValueNodeHasChildrenChange } = context;
109
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange);
110
- const children = childrenProp ?? context.selectedItem;
111
- const hasChildren = !!children;
112
- const selectValueChildren = context.value === void 0 && placeholder !== void 0 ? placeholder : children;
113
- (0, import_core2.useIsomorphicLayoutEffect)(() => {
114
- onValueNodeHasChildrenChange(hasChildren);
115
- }, [onValueNodeHasChildrenChange, hasChildren]);
116
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValueFrame, {
117
- size: context.size,
118
- ref: composedRefs,
119
- pointerEvents: "none",
120
- children: selectValueChildren
121
- });
122
- }
123
- )
124
- );
125
- SelectValue.displayName = VALUE_NAME;
126
- const SelectIcon = (0, import_core2.styled)(import_stacks.XStack, {
127
- name: "SelectIcon",
128
- "aria-hidden": true,
129
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_text.Paragraph, {
130
- children: "\u25BC"
131
- })
132
- });
133
- const ITEM_NAME = "SelectItem";
134
- const [SelectItemContextProvider, useSelectItemContext] = (0, import_context.createSelectContext)(ITEM_NAME);
135
- const SelectItem = React.forwardRef(
136
- (props, forwardedRef) => {
137
- const {
138
- __scopeSelect,
139
- value,
140
- disabled = false,
141
- textValue: textValueProp,
142
- index,
143
- ...itemProps
144
- } = props;
145
- const context = (0, import_context.useSelectContext)(ITEM_NAME, __scopeSelect);
146
- const isSelected = context.value === value;
147
- const textId = (0, import_core3.useId)();
148
- const {
149
- selectedIndex,
150
- setSelectedIndex,
151
- listRef,
152
- open,
153
- setOpen,
154
- onChange,
155
- setActiveIndex,
156
- allowMouseUpRef,
157
- allowSelectRef,
158
- setValueAtIndex,
159
- selectTimeoutRef,
160
- dataRef
161
- } = context;
162
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (node) => {
163
- if (!import_core.isWeb)
164
- return;
165
- if (node instanceof HTMLElement) {
166
- if (listRef) {
167
- listRef.current[index] = node;
168
- }
169
- }
170
- });
171
- React.useEffect(() => {
172
- setValueAtIndex(index, value);
173
- }, [index, setValueAtIndex, value]);
174
- function handleSelect() {
175
- setSelectedIndex(index);
176
- onChange(value);
177
- setOpen(false);
178
- }
179
- const selectItemProps = context.interactions ? context.interactions.getItemProps({
180
- onTouchStart() {
181
- allowSelectRef.current = true;
182
- allowMouseUpRef.current = false;
183
- },
184
- onKeyDown(event) {
185
- if (event.key === "Enter" || event.key === " " && !(dataRef == null ? void 0 : dataRef.current.typing)) {
186
- event.preventDefault();
187
- handleSelect();
188
- } else {
189
- allowSelectRef.current = true;
190
- }
191
- },
192
- onClick() {
193
- if (allowSelectRef.current) {
194
- setSelectedIndex(index);
195
- setOpen(false);
196
- }
197
- },
198
- onMouseUp() {
199
- if (!allowMouseUpRef.current) {
200
- return;
201
- }
202
- if (allowSelectRef.current) {
203
- handleSelect();
204
- }
205
- clearTimeout(selectTimeoutRef.current);
206
- selectTimeoutRef.current = setTimeout(() => {
207
- allowSelectRef.current = true;
208
- });
209
- }
210
- }) : {
211
- onPress: handleSelect
212
- };
213
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemContextProvider, {
214
- scope: __scopeSelect,
215
- value,
216
- textId: textId || "",
217
- isSelected,
218
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItem, {
219
- backgrounded: true,
220
- pressTheme: true,
221
- cursor: "",
222
- focusTheme: true,
223
- outlineWidth: 0,
224
- componentName: ITEM_NAME,
225
- ref: composedRefs,
226
- "aria-labelledby": textId,
227
- "aria-selected": isSelected,
228
- "data-state": isSelected ? "active" : "inactive",
229
- "aria-disabled": disabled || void 0,
230
- "data-disabled": disabled ? "" : void 0,
231
- tabIndex: disabled ? void 0 : -1,
232
- size: context.size,
233
- ...itemProps,
234
- ...selectItemProps
235
- })
236
- });
237
- }
238
- );
239
- SelectItem.displayName = ITEM_NAME;
240
- const ITEM_TEXT_NAME = "SelectItemText";
241
- const SelectItemTextFrame = (0, import_core2.styled)(import_text.SizableText, {
242
- name: ITEM_TEXT_NAME,
243
- selectable: false
244
- });
245
- const SelectItemText = React.forwardRef(
246
- (props, forwardedRef) => {
247
- const { __scopeSelect, className, ...itemTextProps } = props;
248
- const context = (0, import_context.useSelectContext)(ITEM_TEXT_NAME, __scopeSelect);
249
- const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
250
- const ref = React.useRef(null);
251
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
252
- const isSelected = Boolean(itemContext.isSelected && context.valueNode);
253
- const contents = React.useMemo(
254
- () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemTextFrame, {
255
- className,
256
- size: context.size,
257
- id: itemContext.textId,
258
- ...itemTextProps,
259
- ref: composedRefs
260
- }),
261
- [props, context.size, className, itemContext.textId]
262
- );
263
- React.useEffect(() => {
264
- if (isSelected) {
265
- context.setSelectedItem(contents);
266
- }
267
- }, [isSelected, contents]);
268
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
269
- children: contents
270
- });
271
- }
272
- );
273
- SelectItemText.displayName = ITEM_TEXT_NAME;
274
- const ITEM_INDICATOR_NAME = "SelectItemIndicator";
275
- const SelectItemIndicatorFrame = (0, import_core2.styled)(import_stacks.XStack, {
276
- name: ITEM_TEXT_NAME
277
- });
278
- const SelectItemIndicator = React.forwardRef(
279
- (props, forwardedRef) => {
280
- const { __scopeSelect, ...itemIndicatorProps } = props;
281
- const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
282
- return itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, {
283
- "aria-hidden": true,
284
- ...itemIndicatorProps,
285
- ref: forwardedRef
286
- }) : null;
287
- }
288
- );
289
- SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
290
- const GROUP_NAME = "SelectGroup";
291
- const [SelectGroupContextProvider, useSelectGroupContext] = (0, import_context.createSelectContext)(GROUP_NAME);
292
- const SelectGroupFrame = (0, import_core2.styled)(import_stacks.YStack, {
293
- name: GROUP_NAME,
294
- width: "100%"
295
- });
296
- const SelectGroup = React.forwardRef(
297
- (props, forwardedRef) => {
298
- const { __scopeSelect, ...groupProps } = props;
299
- const groupId = (0, import_core3.useId)();
300
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupContextProvider, {
301
- scope: __scopeSelect,
302
- id: groupId || "",
303
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupFrame, {
304
- role: "group",
305
- "aria-labelledby": groupId,
306
- ...groupProps,
307
- ref: forwardedRef
308
- })
309
- });
310
- }
311
- );
312
- SelectGroup.displayName = GROUP_NAME;
313
- const LABEL_NAME = "SelectLabel";
314
- const SelectLabel = React.forwardRef(
315
- (props, forwardedRef) => {
316
- const { __scopeSelect, ...labelProps } = props;
317
- const context = (0, import_context.useSelectContext)(LABEL_NAME, __scopeSelect);
318
- const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
319
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItem, {
320
- componentName: LABEL_NAME,
321
- fontWeight: "800",
322
- id: groupContext.id,
323
- size: context.size,
324
- ...labelProps,
325
- ref: forwardedRef
326
- });
327
- }
328
- );
329
- SelectLabel.displayName = LABEL_NAME;
330
- const SelectSeparator = (0, import_core2.styled)(import_separator.Separator, {
331
- name: "SelectSeparator"
332
- });
333
- const SelectSheetController = (props) => {
334
- const context = (0, import_context.useSelectContext)("SelectSheetController", props.__scopeSelect);
335
- const showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context);
336
- const breakpointActive = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(context.sheetBreakpoint);
337
- const getShowSheet = (0, import_core2.useGet)(showSheet);
338
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sheet.SheetController, {
339
- onOpenChange: (val) => {
340
- if (getShowSheet()) {
341
- props.onOpenChange(val);
342
- }
343
- },
344
- open: context.open,
345
- hidden: breakpointActive === false,
346
- children: props.children
347
- });
348
- };
349
- const SelectSheetImpl = (props) => {
350
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
351
- children: props.children
352
- });
353
- };
354
- const Select = (0, import_core2.withStaticProperties)(
355
- (props) => {
356
- const {
357
- __scopeSelect,
358
- children,
359
- open: openProp,
360
- defaultOpen,
361
- onOpenChange,
362
- value: valueProp,
363
- defaultValue,
364
- onValueChange,
365
- size: sizeProp = "$4",
366
- dir
367
- } = props;
368
- const id = (0, import_core3.useId)();
369
- const scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id;
370
- const { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
371
- Contents: React.useCallback(
372
- () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, {
373
- name: `${scopeKey}SheetContents`
374
- }),
375
- [scopeKey]
376
- )
377
- });
378
- const sheetBreakpoint = when;
379
- const isSheet = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(sheetBreakpoint);
380
- const SelectImpl = isSheet || !import_core.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl;
381
- const forceUpdate = React.useReducer(() => ({}), {})[1];
382
- const [selectedItem, setSelectedItem] = React.useState(null);
383
- const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
384
- prop: openProp,
385
- defaultProp: defaultOpen || false,
386
- onChange: onOpenChange,
387
- strategy: "most-recent-wins"
388
- });
389
- const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
390
- prop: valueProp,
391
- defaultProp: defaultValue || "",
392
- onChange: onValueChange,
393
- strategy: "most-recent-wins",
394
- transition: true
395
- });
396
- const [activeIndex, setActiveIndex] = React.useState(null);
397
- const selectedIndexRef = React.useRef(null);
398
- const activeIndexRef = React.useRef(null);
399
- const listContentRef = React.useRef([]);
400
- const [selectedIndex, setSelectedIndex] = React.useState(
401
- Math.max(0, listContentRef.current.indexOf(value))
402
- );
403
- const [valueNode, setValueNode] = React.useState(null);
404
- const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);
405
- (0, import_core2.useIsomorphicLayoutEffect)(() => {
406
- selectedIndexRef.current = selectedIndex;
407
- activeIndexRef.current = activeIndex;
408
- });
409
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, {
410
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.SelectProvider, {
411
- dir,
412
- blockSelection: false,
413
- size: sizeProp,
414
- fallback: false,
415
- selectedItem,
416
- setSelectedItem,
417
- forceUpdate,
418
- valueNode,
419
- onValueNodeChange: setValueNode,
420
- onValueNodeHasChildrenChange: setValueNodeHasChildren,
421
- valueNodeHasChildren,
422
- scopeKey,
423
- sheetBreakpoint,
424
- scope: __scopeSelect,
425
- setValueAtIndex: (index, value2) => {
426
- listContentRef.current[index] = value2;
427
- },
428
- activeIndex,
429
- onChange: setValue,
430
- selectedIndex,
431
- setActiveIndex,
432
- setOpen,
433
- setSelectedIndex,
434
- value,
435
- open,
436
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectSheetController, {
437
- onOpenChange: setOpen,
438
- __scopeSelect,
439
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectImpl, {
440
- activeIndexRef,
441
- listContentRef,
442
- selectedIndexRef,
443
- ...props,
444
- open,
445
- value,
446
- children
447
- })
448
- })
449
- })
450
- });
451
- },
452
- {
453
- Adapt: import_adapt.Adapt,
454
- Content: import_SelectContent.SelectContent,
455
- Group: SelectGroup,
456
- Icon: SelectIcon,
457
- Item: SelectItem,
458
- ItemIndicator: SelectItemIndicator,
459
- ItemText: SelectItemText,
460
- Label: SelectLabel,
461
- ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
462
- ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
463
- Trigger: SelectTrigger,
464
- Value: SelectValue,
465
- Viewport: import_SelectViewport.SelectViewport,
466
- Sheet: import_sheet.ControlledSheet
467
- }
468
- );
469
- Select.displayName = import_constants.SELECT_NAME;
470
- // Annotate the CommonJS export names for ESM import in node:
471
- 0 && (module.exports = {
472
- Select,
473
- SelectGroupFrame,
474
- SelectIcon,
475
- SelectItem,
476
- SelectItemTextFrame,
477
- SelectSeparator,
478
- SelectTrigger
479
- });
480
- //# sourceMappingURL=Select.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Select.tsx"],
4
- "sourcesContent": ["import { Adapt, useAdaptParent } from '@tamagui/adapt'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { GetProps, TamaguiElement, isClient, isWeb } from '@tamagui/core'\nimport {\n styled,\n useGet,\n useIsomorphicLayoutEffect,\n withStaticProperties,\n} from '@tamagui/core'\nimport { useId } from '@tamagui/core'\nimport { ListItem, ListItemProps } from '@tamagui/list-item'\nimport { PortalHost } from '@tamagui/portal'\nimport { Separator } from '@tamagui/separator'\nimport { ControlledSheet, SheetController } from '@tamagui/sheet'\nimport { XStack, YStack, YStackProps } from '@tamagui/stacks'\nimport { Paragraph, SizableText } from '@tamagui/text'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\n\nimport { SELECT_NAME } from './constants'\nimport { SelectProvider, createSelectContext, useSelectContext } from './context'\nimport { SelectContent } from './SelectContent'\nimport { SelectInlineImpl } from './SelectImpl'\nimport { SelectScrollDownButton, SelectScrollUpButton } from './SelectScrollButton'\nimport { SelectViewport } from './SelectViewport'\nimport { ScopedProps, SelectImplProps, SelectProps } from './types'\nimport {\n useSelectBreakpointActive,\n useShowSelectSheet,\n} from './useSelectBreakpointActive'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'SelectTrigger'\n\nexport type SelectTriggerProps = ListItemProps\n\nexport const SelectTrigger = React.forwardRef<TamaguiElement, SelectTriggerProps>(\n (props: ScopedProps<SelectTriggerProps>, forwardedRef) => {\n const {\n __scopeSelect,\n disabled = false,\n // @ts-ignore\n 'aria-labelledby': ariaLabelledby,\n ...triggerProps\n } = props\n const context = useSelectContext(TRIGGER_NAME, __scopeSelect)\n // const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange)\n // const getItems = useCollection(__scopeSelect)\n // const labelId = useLabelContext(context.trigger)\n const labelledBy = ariaLabelledby // || labelId\n\n return (\n <ListItem\n componentName={TRIGGER_NAME}\n backgrounded\n radiused\n hoverTheme\n pressTheme\n focusTheme\n focusable\n borderWidth={1}\n size={context.size}\n // aria-controls={context.contentId}\n aria-expanded={context.open}\n aria-autocomplete=\"none\"\n aria-labelledby={labelledBy}\n dir={context.dir}\n disabled={disabled}\n data-disabled={disabled ? '' : undefined}\n {...triggerProps}\n ref={forwardedRef}\n {...(process.env.TAMAGUI_TARGET === 'web' && context.interactions\n ? context.interactions.getReferenceProps()\n : {\n onPress() {\n context.setOpen(!context.open)\n },\n })}\n />\n )\n }\n)\n\nSelectTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectValue\n * -----------------------------------------------------------------------------------------------*/\n\nconst VALUE_NAME = 'SelectValue'\n\nconst SelectValueFrame = styled(Paragraph, {\n name: VALUE_NAME,\n selectable: false,\n})\n\ntype SelectValueProps = GetProps<typeof SelectValueFrame> & {\n placeholder?: React.ReactNode\n}\n\nconst SelectValue = SelectValueFrame.extractable(\n React.forwardRef<TamaguiElement, SelectValueProps>(\n (\n {\n __scopeSelect,\n children: childrenProp,\n placeholder,\n }: ScopedProps<SelectValueProps>,\n forwardedRef\n ) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const context = useSelectContext(VALUE_NAME, __scopeSelect)\n const { onValueNodeHasChildrenChange } = context\n const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange)\n\n const children = childrenProp ?? context.selectedItem\n const hasChildren = !!children\n const selectValueChildren =\n context.value === undefined && placeholder !== undefined ? placeholder : children\n\n useIsomorphicLayoutEffect(() => {\n onValueNodeHasChildrenChange(hasChildren)\n }, [onValueNodeHasChildrenChange, hasChildren])\n\n return (\n <SelectValueFrame\n size={context.size}\n ref={composedRefs}\n // we don't want events from the portalled `SelectValue` children to bubble\n // through the item they came from\n pointerEvents=\"none\"\n >\n {selectValueChildren}\n </SelectValueFrame>\n )\n }\n )\n)\n\nSelectValue.displayName = VALUE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectIcon\n * -----------------------------------------------------------------------------------------------*/\n\nexport const SelectIcon = styled(XStack, {\n name: 'SelectIcon',\n // @ts-ignore\n 'aria-hidden': true,\n children: <Paragraph>\u25BC</Paragraph>,\n})\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'SelectItem'\n\ntype SelectItemContextValue = {\n value: string\n textId: string\n isSelected: boolean\n}\n\nconst [SelectItemContextProvider, useSelectItemContext] =\n createSelectContext<SelectItemContextValue>(ITEM_NAME)\n\nexport interface SelectItemProps extends YStackProps {\n value: string\n index: number\n disabled?: boolean\n textValue?: string\n}\n\nexport const SelectItem = React.forwardRef<TamaguiElement, SelectItemProps>(\n (props: ScopedProps<SelectItemProps>, forwardedRef) => {\n const {\n __scopeSelect,\n value,\n disabled = false,\n textValue: textValueProp,\n index,\n ...itemProps\n } = props\n const context = useSelectContext(ITEM_NAME, __scopeSelect)\n const isSelected = context.value === value\n const textId = useId()\n\n const {\n selectedIndex,\n setSelectedIndex,\n listRef,\n open,\n setOpen,\n onChange,\n setActiveIndex,\n allowMouseUpRef,\n allowSelectRef,\n setValueAtIndex,\n selectTimeoutRef,\n dataRef,\n } = context\n\n const composedRefs = useComposedRefs(forwardedRef, (node) => {\n if (!isWeb) return\n if (node instanceof HTMLElement) {\n if (listRef) {\n listRef.current[index] = node\n }\n }\n })\n\n React.useEffect(() => {\n setValueAtIndex(index, value)\n }, [index, setValueAtIndex, value])\n\n function handleSelect() {\n setSelectedIndex(index)\n onChange(value)\n setOpen(false)\n }\n\n const selectItemProps = context.interactions\n ? context.interactions.getItemProps({\n onTouchStart() {\n allowSelectRef!.current = true\n allowMouseUpRef!.current = false\n },\n onKeyDown(event) {\n if (\n event.key === 'Enter' ||\n (event.key === ' ' && !dataRef?.current.typing)\n ) {\n event.preventDefault()\n handleSelect()\n } else {\n allowSelectRef!.current = true\n }\n },\n onClick() {\n if (allowSelectRef!.current) {\n setSelectedIndex(index)\n setOpen(false)\n }\n },\n onMouseUp() {\n if (!allowMouseUpRef!.current) {\n return\n }\n\n if (allowSelectRef!.current) {\n handleSelect()\n }\n\n // On touch devices, prevent the element from\n // immediately closing `onClick` by deferring it\n clearTimeout(selectTimeoutRef!.current)\n selectTimeoutRef!.current = setTimeout(() => {\n allowSelectRef!.current = true\n })\n },\n })\n : {\n onPress: handleSelect,\n }\n\n return (\n <SelectItemContextProvider\n scope={__scopeSelect}\n value={value}\n textId={textId || ''}\n isSelected={isSelected}\n >\n <ListItem\n backgrounded\n pressTheme\n cursor=\"\"\n focusTheme\n outlineWidth={0}\n componentName={ITEM_NAME}\n ref={composedRefs}\n aria-labelledby={textId}\n aria-selected={isSelected}\n data-state={isSelected ? 'active' : 'inactive'}\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n tabIndex={disabled ? undefined : -1}\n size={context.size}\n {...itemProps}\n {...selectItemProps}\n />\n </SelectItemContextProvider>\n )\n }\n)\n\nSelectItem.displayName = ITEM_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'SelectItemText'\n\nexport const SelectItemTextFrame = styled(SizableText, {\n name: ITEM_TEXT_NAME,\n selectable: false,\n})\n\ntype SelectItemTextProps = GetProps<typeof SelectItemTextFrame>\n\nconst SelectItemText = React.forwardRef<TamaguiElement, SelectItemTextProps>(\n (props: ScopedProps<SelectItemTextProps>, forwardedRef) => {\n const { __scopeSelect, className, ...itemTextProps } = props\n const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect)\n const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect)\n const ref = React.useRef<TamaguiElement | null>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const isSelected = Boolean(itemContext.isSelected && context.valueNode)\n\n const contents = React.useMemo(\n () => (\n <SelectItemTextFrame\n className={className}\n size={context.size}\n id={itemContext.textId}\n {...itemTextProps}\n ref={composedRefs}\n />\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [props, context.size, className, itemContext.textId]\n )\n\n // until portals work in sub-trees on RN, use this just for native:\n React.useEffect(() => {\n if (isSelected) {\n context.setSelectedItem(contents)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isSelected, contents])\n\n return (\n <>\n {contents}\n\n {/* Portal the select item text into the trigger value node */}\n {/* this needs some extra stability between renders */}\n {/* {isWeb && isSelected\n ? ReactDOM.createPortal(itemTextProps.children, context.valueNode!)\n : null} */}\n\n {/* Portal an option in the bubble select */}\n {/* {context.bubbleSelect\n ? ReactDOM.createPortal(\n // we use `.textContent` because `option` only support `string` or `number`\n <option value={itemContext.value}>{ref.current?.textContent}</option>,\n context.bubbleSelect\n )\n : null} */}\n </>\n )\n }\n)\n\nSelectItemText.displayName = ITEM_TEXT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'SelectItemIndicator'\n\nconst SelectItemIndicatorFrame = styled(XStack, {\n name: ITEM_TEXT_NAME,\n})\n\ntype SelectItemIndicatorProps = GetProps<typeof SelectItemIndicatorFrame>\n\nconst SelectItemIndicator = React.forwardRef<TamaguiElement, SelectItemIndicatorProps>(\n (props: ScopedProps<SelectItemIndicatorProps>, forwardedRef) => {\n const { __scopeSelect, ...itemIndicatorProps } = props\n const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect)\n return itemContext.isSelected ? (\n <SelectItemIndicatorFrame aria-hidden {...itemIndicatorProps} ref={forwardedRef} />\n ) : null\n }\n)\n\nSelectItemIndicator.displayName = ITEM_INDICATOR_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'SelectGroup'\n\ntype SelectGroupContextValue = { id: string }\n\nconst [SelectGroupContextProvider, useSelectGroupContext] =\n createSelectContext<SelectGroupContextValue>(GROUP_NAME)\n\nexport const SelectGroupFrame = styled(YStack, {\n name: GROUP_NAME,\n width: '100%',\n})\n\ntype SelectGroupProps = GetProps<typeof SelectGroupFrame>\n\nconst SelectGroup = React.forwardRef<TamaguiElement, SelectGroupProps>(\n (props: ScopedProps<SelectGroupProps>, forwardedRef) => {\n const { __scopeSelect, ...groupProps } = props\n const groupId = useId()\n return (\n <SelectGroupContextProvider scope={__scopeSelect} id={groupId || ''}>\n <SelectGroupFrame\n // @ts-ignore\n role=\"group\"\n aria-labelledby={groupId}\n {...groupProps}\n ref={forwardedRef}\n />\n </SelectGroupContextProvider>\n )\n }\n)\n\nSelectGroup.displayName = GROUP_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'SelectLabel'\n\nexport type SelectLabelProps = ListItemProps\n\nconst SelectLabel = React.forwardRef<TamaguiElement, SelectLabelProps>(\n (props: ScopedProps<SelectLabelProps>, forwardedRef) => {\n const { __scopeSelect, ...labelProps } = props\n const context = useSelectContext(LABEL_NAME, __scopeSelect)\n const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect)\n return (\n <ListItem\n componentName={LABEL_NAME}\n fontWeight=\"800\"\n id={groupContext.id}\n size={context.size}\n {...labelProps}\n ref={forwardedRef}\n />\n )\n }\n)\n\nSelectLabel.displayName = LABEL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nexport const SelectSeparator = styled(Separator, {\n name: 'SelectSeparator',\n})\n\nconst SelectSheetController = (\n props: ScopedProps<{}> & {\n children: React.ReactNode\n onOpenChange: React.Dispatch<React.SetStateAction<boolean>>\n }\n) => {\n const context = useSelectContext('SelectSheetController', props.__scopeSelect)\n const showSheet = useShowSelectSheet(context)\n const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint)\n const getShowSheet = useGet(showSheet)\n\n return (\n <SheetController\n onOpenChange={(val) => {\n if (getShowSheet()) {\n props.onOpenChange(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst SelectSheetImpl = (props: SelectImplProps) => {\n return <>{props.children}</>\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Select\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Select = withStaticProperties(\n (props: ScopedProps<SelectProps>) => {\n const {\n __scopeSelect,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n size: sizeProp = '$4',\n dir,\n } = props\n\n const id = useId()\n const scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id\n\n const { when, AdaptProvider } = useAdaptParent({\n Contents: React.useCallback(\n () => <PortalHost name={`${scopeKey}SheetContents`} />,\n [scopeKey]\n ),\n })\n const sheetBreakpoint = when\n const isSheet = useSelectBreakpointActive(sheetBreakpoint)\n const SelectImpl = isSheet || !isWeb ? SelectSheetImpl : SelectInlineImpl\n const forceUpdate = React.useReducer(() => ({}), {})[1]\n const [selectedItem, setSelectedItem] = React.useState<React.ReactNode>(null)\n\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n strategy: 'most-recent-wins',\n })\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue || '',\n onChange: onValueChange,\n strategy: 'most-recent-wins',\n transition: true,\n })\n\n const [activeIndex, setActiveIndex] = React.useState<number | null>(null)\n const selectedIndexRef = React.useRef<number | null>(null)\n const activeIndexRef = React.useRef<number | null>(null)\n\n const listContentRef = React.useRef<string[]>([])\n\n const [selectedIndex, setSelectedIndex] = React.useState(\n Math.max(0, listContentRef.current.indexOf(value))\n )\n\n const [valueNode, setValueNode] = React.useState<HTMLElement | null>(null)\n const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false)\n\n useIsomorphicLayoutEffect(() => {\n selectedIndexRef.current = selectedIndex\n activeIndexRef.current = activeIndex\n })\n\n return (\n <AdaptProvider>\n <SelectProvider\n dir={dir}\n blockSelection={false}\n size={sizeProp}\n fallback={false}\n selectedItem={selectedItem}\n setSelectedItem={setSelectedItem}\n forceUpdate={forceUpdate}\n valueNode={valueNode}\n onValueNodeChange={setValueNode}\n onValueNodeHasChildrenChange={setValueNodeHasChildren}\n valueNodeHasChildren={valueNodeHasChildren}\n scopeKey={scopeKey}\n sheetBreakpoint={sheetBreakpoint}\n scope={__scopeSelect}\n setValueAtIndex={(index, value) => {\n listContentRef.current[index] = value\n }}\n activeIndex={activeIndex}\n onChange={setValue}\n selectedIndex={selectedIndex}\n setActiveIndex={setActiveIndex}\n setOpen={setOpen}\n setSelectedIndex={setSelectedIndex}\n value={value}\n open={open}\n >\n <SelectSheetController onOpenChange={setOpen} __scopeSelect={__scopeSelect}>\n <SelectImpl\n activeIndexRef={activeIndexRef}\n listContentRef={listContentRef}\n selectedIndexRef={selectedIndexRef}\n {...props}\n open={open}\n value={value}\n >\n {children}\n </SelectImpl>\n </SelectSheetController>\n </SelectProvider>\n </AdaptProvider>\n )\n },\n {\n Adapt,\n Content: SelectContent,\n Group: SelectGroup,\n Icon: SelectIcon,\n Item: SelectItem,\n ItemIndicator: SelectItemIndicator,\n ItemText: SelectItemText,\n Label: SelectLabel,\n ScrollDownButton: SelectScrollDownButton,\n ScrollUpButton: SelectScrollUpButton,\n Trigger: SelectTrigger,\n Value: SelectValue,\n Viewport: SelectViewport,\n Sheet: ControlledSheet,\n }\n)\n\n// @ts-ignore\nSelect.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