@tamagui/select 1.0.1-beta.151 → 1.0.1-beta.152

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 (48) hide show
  1. package/dist/cjs/BubbleSelect.js +24 -19
  2. package/dist/cjs/BubbleSelect.js.map +1 -1
  3. package/dist/cjs/Select.js +342 -301
  4. package/dist/cjs/Select.js.map +2 -2
  5. package/dist/cjs/SelectContent.js +18 -15
  6. package/dist/cjs/SelectContent.js.map +1 -1
  7. package/dist/cjs/SelectContent.native.js.map +1 -1
  8. package/dist/cjs/SelectImpl.js +9 -4
  9. package/dist/cjs/SelectImpl.js.map +2 -2
  10. package/dist/cjs/SelectScrollButton.js +109 -95
  11. package/dist/cjs/SelectScrollButton.js.map +2 -2
  12. package/dist/cjs/SelectViewport.js +49 -35
  13. package/dist/cjs/SelectViewport.js.map +2 -2
  14. package/dist/cjs/SelectViewport.native.js +5 -7
  15. package/dist/cjs/SelectViewport.native.js.map +1 -1
  16. package/dist/cjs/context.js.map +1 -1
  17. package/dist/esm/BubbleSelect.js +20 -18
  18. package/dist/esm/BubbleSelect.js.map +1 -1
  19. package/dist/esm/Select.js +338 -300
  20. package/dist/esm/Select.js.map +2 -2
  21. package/dist/esm/SelectContent.js +18 -12
  22. package/dist/esm/SelectContent.js.map +1 -1
  23. package/dist/esm/SelectContent.native.js.map +1 -1
  24. package/dist/esm/SelectImpl.js +5 -3
  25. package/dist/esm/SelectImpl.js.map +2 -2
  26. package/dist/esm/SelectScrollButton.js +105 -94
  27. package/dist/esm/SelectScrollButton.js.map +2 -2
  28. package/dist/esm/SelectViewport.js +45 -34
  29. package/dist/esm/SelectViewport.js.map +1 -1
  30. package/dist/esm/SelectViewport.native.js +5 -4
  31. package/dist/esm/SelectViewport.native.js.map +1 -1
  32. package/dist/esm/context.js.map +1 -1
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/jsx/BubbleSelect.js +20 -18
  35. package/dist/jsx/BubbleSelect.js.map +1 -1
  36. package/dist/jsx/Select.js +217 -196
  37. package/dist/jsx/Select.js.map +2 -2
  38. package/dist/jsx/SelectContent.js.map +1 -1
  39. package/dist/jsx/SelectContent.native.js.map +1 -1
  40. package/dist/jsx/SelectImpl.js.map +2 -2
  41. package/dist/jsx/SelectScrollButton.js +79 -69
  42. package/dist/jsx/SelectScrollButton.js.map +1 -1
  43. package/dist/jsx/SelectViewport.js +25 -23
  44. package/dist/jsx/SelectViewport.js.map +1 -1
  45. package/dist/jsx/SelectViewport.native.js.map +1 -1
  46. package/dist/jsx/context.js.map +1 -1
  47. package/dist/jsx/index.js.map +1 -1
  48. package/package.json +12 -12
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
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
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var Select_exports = {};
23
26
  __export(Select_exports, {
@@ -33,6 +36,7 @@ __export(Select_exports, {
33
36
  useShowSelectSheet: () => useShowSelectSheet
34
37
  });
35
38
  module.exports = __toCommonJS(Select_exports);
39
+ var import_jsx_runtime = require("react/jsx-runtime");
36
40
  var import_compose_refs = require("@tamagui/compose-refs");
37
41
  var import_core = require("@tamagui/core");
38
42
  var import_core2 = require("@tamagui/core");
@@ -53,211 +57,232 @@ var import_SelectImpl = require("./SelectImpl");
53
57
  var import_SelectScrollButton = require("./SelectScrollButton");
54
58
  var import_SelectViewport = require("./SelectViewport");
55
59
  const TRIGGER_NAME = "SelectTrigger";
56
- const SelectTrigger = React.forwardRef((props, forwardedRef) => {
57
- const {
58
- __scopeSelect,
59
- disabled = false,
60
- "aria-labelledby": ariaLabelledby,
61
- ...triggerProps
62
- } = props;
63
- const context = (0, import_context.useSelectContext)(TRIGGER_NAME, __scopeSelect);
64
- const labelledBy = ariaLabelledby;
65
- return /* @__PURE__ */ React.createElement(import_list_item.ListItem, {
66
- componentName: TRIGGER_NAME,
67
- backgrounded: true,
68
- radiused: true,
69
- hoverTheme: true,
70
- pressTheme: true,
71
- focusTheme: true,
72
- focusable: true,
73
- borderWidth: 1,
74
- size: context.size,
75
- "aria-expanded": context.open,
76
- "aria-autocomplete": "none",
77
- "aria-labelledby": labelledBy,
78
- dir: context.dir,
79
- disabled,
80
- "data-disabled": disabled ? "" : void 0,
81
- ...triggerProps,
82
- ref: forwardedRef,
83
- ...process.env.TAMAGUI_TARGET === "web" && context.interactions ? context.interactions.getReferenceProps() : {
84
- onPress() {
85
- context.setOpen(!context.open);
60
+ const SelectTrigger = React.forwardRef(
61
+ (props, forwardedRef) => {
62
+ const {
63
+ __scopeSelect,
64
+ disabled = false,
65
+ "aria-labelledby": ariaLabelledby,
66
+ ...triggerProps
67
+ } = props;
68
+ const context = (0, import_context.useSelectContext)(TRIGGER_NAME, __scopeSelect);
69
+ const labelledBy = ariaLabelledby;
70
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItem, {
71
+ componentName: TRIGGER_NAME,
72
+ backgrounded: true,
73
+ radiused: true,
74
+ hoverTheme: true,
75
+ pressTheme: true,
76
+ focusTheme: true,
77
+ focusable: true,
78
+ borderWidth: 1,
79
+ size: context.size,
80
+ "aria-expanded": context.open,
81
+ "aria-autocomplete": "none",
82
+ "aria-labelledby": labelledBy,
83
+ dir: context.dir,
84
+ disabled,
85
+ "data-disabled": disabled ? "" : void 0,
86
+ ...triggerProps,
87
+ ref: forwardedRef,
88
+ ...process.env.TAMAGUI_TARGET === "web" && context.interactions ? context.interactions.getReferenceProps() : {
89
+ onPress() {
90
+ context.setOpen(!context.open);
91
+ }
86
92
  }
87
- }
88
- });
89
- });
93
+ });
94
+ }
95
+ );
90
96
  SelectTrigger.displayName = TRIGGER_NAME;
91
97
  const VALUE_NAME = "SelectValue";
92
98
  const SelectValueFrame = (0, import_core2.styled)(import_text.Paragraph, {
93
99
  name: VALUE_NAME,
94
100
  selectable: false
95
101
  });
96
- const SelectValue = SelectValueFrame.extractable(React.forwardRef(({ __scopeSelect, children: childrenProp, placeholder }, forwardedRef) => {
97
- const context = (0, import_context.useSelectContext)(VALUE_NAME, __scopeSelect);
98
- const { onValueNodeHasChildrenChange } = context;
99
- const hasChildren = childrenProp !== void 0;
100
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange);
101
- (0, import_core2.useIsomorphicLayoutEffect)(() => {
102
- onValueNodeHasChildrenChange(hasChildren);
103
- }, [onValueNodeHasChildrenChange, hasChildren]);
104
- const children = childrenProp ?? context.selectedItem;
105
- return /* @__PURE__ */ React.createElement(SelectValueFrame, {
106
- size: context.size,
107
- ref: composedRefs,
108
- pointerEvents: "none"
109
- }, context.value === void 0 && placeholder !== void 0 ? placeholder : children);
110
- }));
102
+ const SelectValue = SelectValueFrame.extractable(
103
+ React.forwardRef(
104
+ ({ __scopeSelect, children: childrenProp, placeholder }, forwardedRef) => {
105
+ const context = (0, import_context.useSelectContext)(VALUE_NAME, __scopeSelect);
106
+ const { onValueNodeHasChildrenChange } = context;
107
+ const hasChildren = childrenProp !== void 0;
108
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange);
109
+ (0, import_core2.useIsomorphicLayoutEffect)(() => {
110
+ onValueNodeHasChildrenChange(hasChildren);
111
+ }, [onValueNodeHasChildrenChange, hasChildren]);
112
+ const children = childrenProp ?? context.selectedItem;
113
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValueFrame, {
114
+ size: context.size,
115
+ ref: composedRefs,
116
+ pointerEvents: "none",
117
+ children: context.value === void 0 && placeholder !== void 0 ? placeholder : children
118
+ });
119
+ }
120
+ )
121
+ );
111
122
  SelectValue.displayName = VALUE_NAME;
112
123
  const SelectIcon = (0, import_core2.styled)(import_stacks.XStack, {
113
124
  name: "SelectIcon",
114
125
  "aria-hidden": true,
115
- children: /* @__PURE__ */ React.createElement(import_text.Paragraph, null, "\u25BC")
126
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_text.Paragraph, {
127
+ children: "\u25BC"
128
+ })
116
129
  });
117
130
  const ITEM_NAME = "SelectItem";
118
131
  const [SelectItemContextProvider, useSelectItemContext] = (0, import_context.createSelectContext)(ITEM_NAME);
119
- const SelectItem = React.forwardRef((props, forwardedRef) => {
120
- const {
121
- __scopeSelect,
122
- value,
123
- disabled = false,
124
- textValue: textValueProp,
125
- index,
126
- ...itemProps
127
- } = props;
128
- const context = (0, import_context.useSelectContext)(ITEM_NAME, __scopeSelect);
129
- const isSelected = context.value === value;
130
- const textId = (0, import_core3.useId)();
131
- const {
132
- selectedIndex,
133
- setSelectedIndex,
134
- listRef,
135
- open,
136
- setOpen,
137
- onChange,
138
- setActiveIndex,
139
- allowMouseUpRef,
140
- allowSelectRef,
141
- setValueAtIndex,
142
- selectTimeoutRef,
143
- dataRef
144
- } = context;
145
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (node) => {
146
- if (!import_core.isWeb)
147
- return;
148
- if (node instanceof HTMLElement) {
149
- if (listRef) {
150
- listRef.current[index] = node;
132
+ const SelectItem = React.forwardRef(
133
+ (props, forwardedRef) => {
134
+ const {
135
+ __scopeSelect,
136
+ value,
137
+ disabled = false,
138
+ textValue: textValueProp,
139
+ index,
140
+ ...itemProps
141
+ } = props;
142
+ const context = (0, import_context.useSelectContext)(ITEM_NAME, __scopeSelect);
143
+ const isSelected = context.value === value;
144
+ const textId = (0, import_core3.useId)();
145
+ const {
146
+ selectedIndex,
147
+ setSelectedIndex,
148
+ listRef,
149
+ open,
150
+ setOpen,
151
+ onChange,
152
+ setActiveIndex,
153
+ allowMouseUpRef,
154
+ allowSelectRef,
155
+ setValueAtIndex,
156
+ selectTimeoutRef,
157
+ dataRef
158
+ } = context;
159
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (node) => {
160
+ if (!import_core.isWeb)
161
+ return;
162
+ if (node instanceof HTMLElement) {
163
+ if (listRef) {
164
+ listRef.current[index] = node;
165
+ }
151
166
  }
167
+ });
168
+ React.useEffect(() => {
169
+ setValueAtIndex(index, value);
170
+ }, [index, setValueAtIndex, value]);
171
+ function handleSelect() {
172
+ setSelectedIndex(index);
173
+ onChange(value);
174
+ setOpen(false);
152
175
  }
153
- });
154
- React.useEffect(() => {
155
- setValueAtIndex(index, value);
156
- }, [index, setValueAtIndex, value]);
157
- function handleSelect() {
158
- setSelectedIndex(index);
159
- onChange(value);
160
- setOpen(false);
161
- }
162
- const selectItemProps = context.interactions ? context.interactions.getItemProps({
163
- onTouchStart() {
164
- allowSelectRef.current = true;
165
- allowMouseUpRef.current = false;
166
- },
167
- onKeyDown(event) {
168
- if (event.key === "Enter" || event.key === " " && !(dataRef == null ? void 0 : dataRef.current.typing)) {
169
- event.preventDefault();
170
- handleSelect();
171
- } else {
176
+ const selectItemProps = context.interactions ? context.interactions.getItemProps({
177
+ onTouchStart() {
172
178
  allowSelectRef.current = true;
179
+ allowMouseUpRef.current = false;
180
+ },
181
+ onKeyDown(event) {
182
+ if (event.key === "Enter" || event.key === " " && !(dataRef == null ? void 0 : dataRef.current.typing)) {
183
+ event.preventDefault();
184
+ handleSelect();
185
+ } else {
186
+ allowSelectRef.current = true;
187
+ }
188
+ },
189
+ onClick() {
190
+ if (allowSelectRef.current) {
191
+ setSelectedIndex(index);
192
+ setOpen(false);
193
+ }
194
+ },
195
+ onMouseUp() {
196
+ if (!allowMouseUpRef.current) {
197
+ return;
198
+ }
199
+ if (allowSelectRef.current) {
200
+ handleSelect();
201
+ }
202
+ clearTimeout(selectTimeoutRef.current);
203
+ selectTimeoutRef.current = setTimeout(() => {
204
+ allowSelectRef.current = true;
205
+ });
173
206
  }
174
- },
175
- onClick() {
176
- if (allowSelectRef.current) {
177
- setSelectedIndex(index);
178
- setOpen(false);
179
- }
180
- },
181
- onMouseUp() {
182
- if (!allowMouseUpRef.current) {
183
- return;
184
- }
185
- if (allowSelectRef.current) {
186
- handleSelect();
187
- }
188
- clearTimeout(selectTimeoutRef.current);
189
- selectTimeoutRef.current = setTimeout(() => {
190
- allowSelectRef.current = true;
191
- });
192
- }
193
- }) : {
194
- onPress: handleSelect
195
- };
196
- return /* @__PURE__ */ React.createElement(SelectItemContextProvider, {
197
- scope: __scopeSelect,
198
- value,
199
- textId: textId || "",
200
- isSelected
201
- }, /* @__PURE__ */ React.createElement(import_list_item.ListItem, {
202
- backgrounded: true,
203
- pressTheme: true,
204
- focusTheme: true,
205
- componentName: ITEM_NAME,
206
- ref: composedRefs,
207
- "aria-labelledby": textId,
208
- "aria-selected": isSelected,
209
- "data-state": isSelected ? "active" : "inactive",
210
- "aria-disabled": disabled || void 0,
211
- "data-disabled": disabled ? "" : void 0,
212
- tabIndex: disabled ? void 0 : -1,
213
- size: context.size,
214
- ...itemProps,
215
- ...selectItemProps
216
- }));
217
- });
207
+ }) : {
208
+ onPress: handleSelect
209
+ };
210
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemContextProvider, {
211
+ scope: __scopeSelect,
212
+ value,
213
+ textId: textId || "",
214
+ isSelected,
215
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItem, {
216
+ backgrounded: true,
217
+ pressTheme: true,
218
+ focusTheme: true,
219
+ componentName: ITEM_NAME,
220
+ ref: composedRefs,
221
+ "aria-labelledby": textId,
222
+ "aria-selected": isSelected,
223
+ "data-state": isSelected ? "active" : "inactive",
224
+ "aria-disabled": disabled || void 0,
225
+ "data-disabled": disabled ? "" : void 0,
226
+ tabIndex: disabled ? void 0 : -1,
227
+ size: context.size,
228
+ ...itemProps,
229
+ ...selectItemProps
230
+ })
231
+ });
232
+ }
233
+ );
218
234
  SelectItem.displayName = ITEM_NAME;
219
235
  const ITEM_TEXT_NAME = "SelectItemText";
220
236
  const SelectItemTextFrame = (0, import_core2.styled)(import_text.Paragraph, {
221
237
  name: ITEM_TEXT_NAME,
222
238
  selectable: false
223
239
  });
224
- const SelectItemText = React.forwardRef((props, forwardedRef) => {
225
- const { __scopeSelect, className, ...itemTextProps } = props;
226
- const context = (0, import_context.useSelectContext)(ITEM_TEXT_NAME, __scopeSelect);
227
- const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
228
- const ref = React.useRef(null);
229
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
230
- const isSelected = itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren;
231
- const contents = /* @__PURE__ */ React.createElement(SelectItemTextFrame, {
232
- className,
233
- size: context.size,
234
- id: itemContext.textId,
235
- ...itemTextProps,
236
- ref: composedRefs
237
- });
238
- if (!import_core.isWeb) {
239
- React.useEffect(() => {
240
- if (isSelected) {
241
- context.setSelectedItem(contents);
242
- }
243
- }, [isSelected]);
240
+ const SelectItemText = React.forwardRef(
241
+ (props, forwardedRef) => {
242
+ const { __scopeSelect, className, ...itemTextProps } = props;
243
+ const context = (0, import_context.useSelectContext)(ITEM_TEXT_NAME, __scopeSelect);
244
+ const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
245
+ const ref = React.useRef(null);
246
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
247
+ const isSelected = itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren;
248
+ const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemTextFrame, {
249
+ className,
250
+ size: context.size,
251
+ id: itemContext.textId,
252
+ ...itemTextProps,
253
+ ref: composedRefs
254
+ });
255
+ if (!import_core.isWeb) {
256
+ React.useEffect(() => {
257
+ if (isSelected) {
258
+ context.setSelectedItem(contents);
259
+ }
260
+ }, [isSelected]);
261
+ }
262
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
263
+ children: [
264
+ contents,
265
+ import_core.isWeb && isSelected ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null
266
+ ]
267
+ });
244
268
  }
245
- return /* @__PURE__ */ React.createElement(React.Fragment, null, contents, import_core.isWeb && isSelected ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null);
246
- });
269
+ );
247
270
  SelectItemText.displayName = ITEM_TEXT_NAME;
248
271
  const ITEM_INDICATOR_NAME = "SelectItemIndicator";
249
272
  const SelectItemIndicatorFrame = (0, import_core2.styled)(import_stacks.XStack, {
250
273
  name: ITEM_TEXT_NAME
251
274
  });
252
- const SelectItemIndicator = React.forwardRef((props, forwardedRef) => {
253
- const { __scopeSelect, ...itemIndicatorProps } = props;
254
- const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
255
- return itemContext.isSelected ? /* @__PURE__ */ React.createElement(SelectItemIndicatorFrame, {
256
- "aria-hidden": true,
257
- ...itemIndicatorProps,
258
- ref: forwardedRef
259
- }) : null;
260
- });
275
+ const SelectItemIndicator = React.forwardRef(
276
+ (props, forwardedRef) => {
277
+ const { __scopeSelect, ...itemIndicatorProps } = props;
278
+ const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
279
+ return itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, {
280
+ "aria-hidden": true,
281
+ ...itemIndicatorProps,
282
+ ref: forwardedRef
283
+ }) : null;
284
+ }
285
+ );
261
286
  SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
262
287
  const GROUP_NAME = "SelectGroup";
263
288
  const [SelectGroupContextProvider, useSelectGroupContext] = (0, import_context.createSelectContext)(GROUP_NAME);
@@ -265,34 +290,39 @@ const SelectGroupFrame = (0, import_core2.styled)(import_stacks.YStack, {
265
290
  name: GROUP_NAME,
266
291
  width: "100%"
267
292
  });
268
- const SelectGroup = React.forwardRef((props, forwardedRef) => {
269
- const { __scopeSelect, ...groupProps } = props;
270
- const groupId = (0, import_core3.useId)();
271
- return /* @__PURE__ */ React.createElement(SelectGroupContextProvider, {
272
- scope: __scopeSelect,
273
- id: groupId || ""
274
- }, /* @__PURE__ */ React.createElement(SelectGroupFrame, {
275
- role: "group",
276
- "aria-labelledby": groupId,
277
- ...groupProps,
278
- ref: forwardedRef
279
- }));
280
- });
293
+ const SelectGroup = React.forwardRef(
294
+ (props, forwardedRef) => {
295
+ const { __scopeSelect, ...groupProps } = props;
296
+ const groupId = (0, import_core3.useId)();
297
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupContextProvider, {
298
+ scope: __scopeSelect,
299
+ id: groupId || "",
300
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupFrame, {
301
+ role: "group",
302
+ "aria-labelledby": groupId,
303
+ ...groupProps,
304
+ ref: forwardedRef
305
+ })
306
+ });
307
+ }
308
+ );
281
309
  SelectGroup.displayName = GROUP_NAME;
282
310
  const LABEL_NAME = "SelectLabel";
283
- const SelectLabel = React.forwardRef((props, forwardedRef) => {
284
- const { __scopeSelect, ...labelProps } = props;
285
- const context = (0, import_context.useSelectContext)(LABEL_NAME, __scopeSelect);
286
- const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
287
- return /* @__PURE__ */ React.createElement(import_list_item.ListItem, {
288
- componentName: LABEL_NAME,
289
- fontWeight: "800",
290
- id: groupContext.id,
291
- size: context.size,
292
- ...labelProps,
293
- ref: forwardedRef
294
- });
295
- });
311
+ const SelectLabel = React.forwardRef(
312
+ (props, forwardedRef) => {
313
+ const { __scopeSelect, ...labelProps } = props;
314
+ const context = (0, import_context.useSelectContext)(LABEL_NAME, __scopeSelect);
315
+ const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
316
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItem, {
317
+ componentName: LABEL_NAME,
318
+ fontWeight: "800",
319
+ id: groupContext.id,
320
+ size: context.size,
321
+ ...labelProps,
322
+ ref: forwardedRef
323
+ });
324
+ }
325
+ );
296
326
  SelectLabel.displayName = LABEL_NAME;
297
327
  const SelectSeparator = (0, import_core2.styled)(import_separator.Separator, {
298
328
  name: "SelectSeparator"
@@ -310,121 +340,132 @@ const SelectSheetController = (props) => {
310
340
  const showSheet = useShowSelectSheet(context);
311
341
  const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
312
342
  const getShowSheet = (0, import_core2.useGet)(showSheet);
313
- return /* @__PURE__ */ React.createElement(import_sheet.SheetController, {
343
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sheet.SheetController, {
314
344
  onChangeOpen: (val) => {
315
345
  if (getShowSheet()) {
316
346
  props.onChangeOpen(val);
317
347
  }
318
348
  },
319
349
  open: context.open,
320
- hidden: breakpointActive === false
321
- }, props.children);
350
+ hidden: breakpointActive === false,
351
+ children: props.children
352
+ });
322
353
  };
323
354
  const SHEET_CONTENTS_NAME = "SelectSheetContents";
324
355
  const SelectSheetContents = ({ __scopeSelect }) => {
325
356
  const context = (0, import_context.useSelectContext)(SHEET_CONTENTS_NAME, __scopeSelect);
326
- return /* @__PURE__ */ React.createElement(import_portal.PortalHost, {
357
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, {
327
358
  name: `${context.scopeKey}SheetContents`
328
359
  });
329
360
  };
330
361
  SelectSheetContents.displayName = SHEET_CONTENTS_NAME;
331
362
  const SelectSheetImpl = (props) => {
332
- return /* @__PURE__ */ React.createElement(React.Fragment, null, props.children);
333
- };
334
- const Select = (0, import_core2.withStaticProperties)((props) => {
335
- const {
336
- __scopeSelect,
337
- children,
338
- open: openProp,
339
- defaultOpen,
340
- onOpenChange,
341
- value: valueProp,
342
- defaultValue,
343
- onValueChange,
344
- size: sizeProp = "$4",
345
- sheetBreakpoint = false,
346
- dir
347
- } = props;
348
- const isSheet = useSelectBreakpointActive(sheetBreakpoint);
349
- const SelectImpl = isSheet ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl;
350
- const forceUpdate = React.useReducer(() => ({}), {})[1];
351
- const [selectedItem, setSelectedItem] = React.useState(null);
352
- const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
353
- prop: openProp,
354
- defaultProp: defaultOpen || false,
355
- onChange: onOpenChange,
356
- strategy: "most-recent-wins"
357
- });
358
- const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
359
- prop: valueProp,
360
- defaultProp: defaultValue || "",
361
- onChange: onValueChange,
362
- strategy: "most-recent-wins"
363
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
364
+ children: props.children
363
365
  });
364
- const [activeIndex, setActiveIndex] = React.useState(null);
365
- const selectedIndexRef = React.useRef(null);
366
- const activeIndexRef = React.useRef(null);
367
- const listContentRef = React.useRef([]);
368
- const [selectedIndex, setSelectedIndex] = React.useState(Math.max(0, listContentRef.current.indexOf(value)));
369
- const [valueNode, setValueNode] = React.useState(null);
370
- const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);
371
- (0, import_core2.useIsomorphicLayoutEffect)(() => {
372
- selectedIndexRef.current = selectedIndex;
373
- activeIndexRef.current = activeIndex;
374
- });
375
- return /* @__PURE__ */ React.createElement(import_context.SelectProvider, {
376
- dir,
377
- blockSelection: false,
378
- size: sizeProp,
379
- fallback: false,
380
- selectedItem,
381
- setSelectedItem,
382
- forceUpdate,
383
- valueNode,
384
- onValueNodeChange: setValueNode,
385
- onValueNodeHasChildrenChange: setValueNodeHasChildren,
386
- valueNodeHasChildren,
387
- scopeKey: __scopeSelect ? Object.keys(__scopeSelect)[0] : "",
388
- sheetBreakpoint,
389
- scope: __scopeSelect,
390
- setValueAtIndex: (index, value2) => {
391
- listContentRef.current[index] = value2;
392
- },
393
- activeIndex,
394
- onChange: setValue,
395
- selectedIndex,
396
- setActiveIndex,
397
- setOpen,
398
- setSelectedIndex,
399
- value,
400
- open
401
- }, /* @__PURE__ */ React.createElement(SelectSheetController, {
402
- onChangeOpen: setOpen,
403
- __scopeSelect
404
- }, /* @__PURE__ */ React.createElement(SelectImpl, {
405
- activeIndexRef,
406
- listContentRef,
407
- selectedIndexRef,
408
- ...props,
409
- open,
410
- value
411
- }, children)));
412
- }, {
413
- Content: import_SelectContent.SelectContent,
414
- Group: SelectGroup,
415
- Icon: SelectIcon,
416
- Item: SelectItem,
417
- ItemIndicator: SelectItemIndicator,
418
- ItemText: SelectItemText,
419
- Label: SelectLabel,
420
- ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
421
- ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
422
- Trigger: SelectTrigger,
423
- Value: SelectValue,
424
- Viewport: import_SelectViewport.SelectViewport,
425
- SheetContents: SelectSheetContents,
426
- Sheet: import_sheet.Sheet
427
- });
366
+ };
367
+ const Select = (0, import_core2.withStaticProperties)(
368
+ (props) => {
369
+ const {
370
+ __scopeSelect,
371
+ children,
372
+ open: openProp,
373
+ defaultOpen,
374
+ onOpenChange,
375
+ value: valueProp,
376
+ defaultValue,
377
+ onValueChange,
378
+ size: sizeProp = "$4",
379
+ sheetBreakpoint = false,
380
+ dir
381
+ } = props;
382
+ const isSheet = useSelectBreakpointActive(sheetBreakpoint);
383
+ const SelectImpl = isSheet ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl;
384
+ const forceUpdate = React.useReducer(() => ({}), {})[1];
385
+ const [selectedItem, setSelectedItem] = React.useState(null);
386
+ const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
387
+ prop: openProp,
388
+ defaultProp: defaultOpen || false,
389
+ onChange: onOpenChange,
390
+ strategy: "most-recent-wins"
391
+ });
392
+ const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
393
+ prop: valueProp,
394
+ defaultProp: defaultValue || "",
395
+ onChange: onValueChange,
396
+ strategy: "most-recent-wins"
397
+ });
398
+ const [activeIndex, setActiveIndex] = React.useState(null);
399
+ const selectedIndexRef = React.useRef(null);
400
+ const activeIndexRef = React.useRef(null);
401
+ const listContentRef = React.useRef([]);
402
+ const [selectedIndex, setSelectedIndex] = React.useState(
403
+ Math.max(0, listContentRef.current.indexOf(value))
404
+ );
405
+ const [valueNode, setValueNode] = React.useState(null);
406
+ const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);
407
+ (0, import_core2.useIsomorphicLayoutEffect)(() => {
408
+ selectedIndexRef.current = selectedIndex;
409
+ activeIndexRef.current = activeIndex;
410
+ });
411
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.SelectProvider, {
412
+ dir,
413
+ blockSelection: false,
414
+ size: sizeProp,
415
+ fallback: false,
416
+ selectedItem,
417
+ setSelectedItem,
418
+ forceUpdate,
419
+ valueNode,
420
+ onValueNodeChange: setValueNode,
421
+ onValueNodeHasChildrenChange: setValueNodeHasChildren,
422
+ valueNodeHasChildren,
423
+ scopeKey: __scopeSelect ? Object.keys(__scopeSelect)[0] : "",
424
+ sheetBreakpoint,
425
+ scope: __scopeSelect,
426
+ setValueAtIndex: (index, value2) => {
427
+ listContentRef.current[index] = value2;
428
+ },
429
+ activeIndex,
430
+ onChange: setValue,
431
+ selectedIndex,
432
+ setActiveIndex,
433
+ setOpen,
434
+ setSelectedIndex,
435
+ value,
436
+ open,
437
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectSheetController, {
438
+ onChangeOpen: setOpen,
439
+ __scopeSelect,
440
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectImpl, {
441
+ activeIndexRef,
442
+ listContentRef,
443
+ selectedIndexRef,
444
+ ...props,
445
+ open,
446
+ value,
447
+ children
448
+ })
449
+ })
450
+ });
451
+ },
452
+ {
453
+ Content: import_SelectContent.SelectContent,
454
+ Group: SelectGroup,
455
+ Icon: SelectIcon,
456
+ Item: SelectItem,
457
+ ItemIndicator: SelectItemIndicator,
458
+ ItemText: SelectItemText,
459
+ Label: SelectLabel,
460
+ ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
461
+ ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
462
+ Trigger: SelectTrigger,
463
+ Value: SelectValue,
464
+ Viewport: import_SelectViewport.SelectViewport,
465
+ SheetContents: SelectSheetContents,
466
+ Sheet: import_sheet.Sheet
467
+ }
468
+ );
428
469
  Select.displayName = import_constants.SELECT_NAME;
429
470
  // Annotate the CommonJS export names for ESM import in node:
430
471
  0 && (module.exports = {