@tamagui/select 1.89.26 → 1.89.27-1708112217600

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 (77) hide show
  1. package/dist/cjs/BubbleSelect.native.js +0 -13
  2. package/dist/cjs/BubbleSelect.native.js.map +2 -2
  3. package/dist/cjs/Select.native.js +335 -242
  4. package/dist/cjs/Select.native.js.map +3 -3
  5. package/dist/cjs/SelectContent.native.js +4 -1
  6. package/dist/cjs/SelectContent.native.js.map +3 -3
  7. package/dist/cjs/SelectImpl.native.js +3 -2
  8. package/dist/cjs/SelectImpl.native.js.map +3 -3
  9. package/dist/cjs/SelectItem.native.js +172 -97
  10. package/dist/cjs/SelectItem.native.js.map +3 -3
  11. package/dist/cjs/SelectItemText.native.js +73 -16
  12. package/dist/cjs/SelectItemText.native.js.map +3 -3
  13. package/dist/cjs/SelectScrollButton.native.js +5 -1
  14. package/dist/cjs/SelectScrollButton.native.js.map +3 -3
  15. package/dist/cjs/SelectTrigger.native.js +92 -42
  16. package/dist/cjs/SelectTrigger.native.js.map +3 -3
  17. package/dist/cjs/SelectViewport.native.js +13 -12
  18. package/dist/cjs/SelectViewport.native.js.map +3 -3
  19. package/dist/cjs/constants.native.js +1 -1
  20. package/dist/cjs/constants.native.js.map +3 -3
  21. package/dist/cjs/context.native.js +76 -7
  22. package/dist/cjs/context.native.js.map +3 -3
  23. package/dist/cjs/index.native.js.map +2 -2
  24. package/dist/cjs/types.native.js.map +2 -2
  25. package/dist/cjs/useSelectBreakpointActive.native.js +4 -5
  26. package/dist/cjs/useSelectBreakpointActive.native.js.map +3 -3
  27. package/dist/esm/BubbleSelect.native.js +0 -13
  28. package/dist/esm/BubbleSelect.native.js.map +3 -3
  29. package/dist/esm/Select.native.js +336 -253
  30. package/dist/esm/Select.native.js.map +3 -3
  31. package/dist/esm/SelectContent.native.js +4 -1
  32. package/dist/esm/SelectContent.native.js.map +3 -3
  33. package/dist/esm/SelectImpl.native.js +3 -2
  34. package/dist/esm/SelectImpl.native.js.map +3 -3
  35. package/dist/esm/SelectItem.native.js +171 -97
  36. package/dist/esm/SelectItem.native.js.map +3 -3
  37. package/dist/esm/SelectItemText.native.js +72 -16
  38. package/dist/esm/SelectItemText.native.js.map +3 -3
  39. package/dist/esm/SelectScrollButton.native.js +5 -1
  40. package/dist/esm/SelectScrollButton.native.js.map +3 -3
  41. package/dist/esm/SelectTrigger.native.js +91 -42
  42. package/dist/esm/SelectTrigger.native.js.map +3 -3
  43. package/dist/esm/SelectViewport.native.js +14 -17
  44. package/dist/esm/SelectViewport.native.js.map +3 -3
  45. package/dist/esm/constants.native.js +1 -1
  46. package/dist/esm/constants.native.js.map +3 -3
  47. package/dist/esm/context.native.js +75 -7
  48. package/dist/esm/context.native.js.map +3 -3
  49. package/dist/esm/index.native.js.map +1 -1
  50. package/dist/esm/useSelectBreakpointActive.native.js +4 -4
  51. package/dist/esm/useSelectBreakpointActive.native.js.map +3 -3
  52. package/dist/jsx/BubbleSelect.native.js +0 -13
  53. package/dist/jsx/BubbleSelect.native.js.map +3 -3
  54. package/dist/jsx/Select.native.js +336 -253
  55. package/dist/jsx/Select.native.js.map +3 -3
  56. package/dist/jsx/SelectContent.native.js +4 -1
  57. package/dist/jsx/SelectContent.native.js.map +3 -3
  58. package/dist/jsx/SelectImpl.native.js +3 -2
  59. package/dist/jsx/SelectImpl.native.js.map +3 -3
  60. package/dist/jsx/SelectItem.native.js +171 -97
  61. package/dist/jsx/SelectItem.native.js.map +3 -3
  62. package/dist/jsx/SelectItemText.native.js +72 -16
  63. package/dist/jsx/SelectItemText.native.js.map +3 -3
  64. package/dist/jsx/SelectScrollButton.native.js +5 -1
  65. package/dist/jsx/SelectScrollButton.native.js.map +3 -3
  66. package/dist/jsx/SelectTrigger.native.js +91 -42
  67. package/dist/jsx/SelectTrigger.native.js.map +3 -3
  68. package/dist/jsx/SelectViewport.native.js +14 -17
  69. package/dist/jsx/SelectViewport.native.js.map +3 -3
  70. package/dist/jsx/constants.native.js +1 -1
  71. package/dist/jsx/constants.native.js.map +3 -3
  72. package/dist/jsx/context.native.js +75 -7
  73. package/dist/jsx/context.native.js.map +3 -3
  74. package/dist/jsx/index.native.js.map +1 -1
  75. package/dist/jsx/useSelectBreakpointActive.native.js +4 -4
  76. package/dist/jsx/useSelectBreakpointActive.native.js.map +3 -3
  77. package/package.json +24 -24
@@ -29,62 +29,171 @@ __export(Select_exports, {
29
29
  SelectSeparator: () => SelectSeparator
30
30
  });
31
31
  module.exports = __toCommonJS(Select_exports);
32
- var import_adapt = require("@tamagui/adapt"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_helpers = require("@tamagui/helpers"), import_list_item = require("@tamagui/list-item"), import_portal = require("@tamagui/portal"), import_separator = require("@tamagui/separator"), import_sheet = require("@tamagui/sheet"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_use_debounce = require("@tamagui/use-debounce"), import_constants2 = require("./constants"), import_context = require("./context"), import_SelectContent = require("./SelectContent"), import_SelectImpl = require("./SelectImpl"), import_SelectItem = require("./SelectItem"), import_SelectItemText = require("./SelectItemText"), import_SelectScrollButton = require("./SelectScrollButton"), import_SelectTrigger = require("./SelectTrigger"), import_SelectViewport = require("./SelectViewport"), import_useSelectBreakpointActive = require("./useSelectBreakpointActive"), import_jsx_runtime = require("react/jsx-runtime");
33
- const VALUE_NAME = "SelectValue", SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
34
- name: VALUE_NAME,
35
- userSelect: "none"
36
- }), SelectValue = SelectValueFrame.styleable(
37
- function({
38
- __scopeSelect,
39
- children: childrenProp,
40
- placeholder,
41
- ...props
42
- }, forwardedRef) {
43
- const context = (0, import_context.useSelectContext)(VALUE_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(VALUE_NAME, __scopeSelect), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange), children = childrenProp ?? context.selectedItem, selectValueChildren = context.value == null || context.value === "" ? placeholder ?? children : children;
44
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
- SelectValueFrame,
46
- {
47
- ...!props.unstyled && {
48
- size: itemParentContext.size,
49
- ellipse: !0,
50
- // we don't want events from the portalled `SelectValue` children to bubble
51
- // through the item they came from
52
- pointerEvents: "none"
53
- },
54
- ref: composedRefs,
55
- ...props,
56
- children: unwrapSelectItem(selectValueChildren)
32
+ var import_adapt = require("@tamagui/adapt"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_helpers = require("@tamagui/helpers"), import_list_item = require("@tamagui/list-item"), import_portal = require("@tamagui/portal"), import_separator = require("@tamagui/separator"), import_sheet = require("@tamagui/sheet"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_use_debounce = require("@tamagui/use-debounce"), import_constants2 = require("./constants"), import_context = require("./context"), import_SelectContent = require("./SelectContent"), import_SelectImpl = require("./SelectImpl"), import_SelectItem = require("./SelectItem"), import_SelectItemText = require("./SelectItemText"), import_SelectScrollButton = require("./SelectScrollButton"), import_SelectTrigger = require("./SelectTrigger"), import_SelectViewport = require("./SelectViewport"), import_useSelectBreakpointActive = require("./useSelectBreakpointActive");
33
+ function _array_like_to_array(arr, len) {
34
+ (len == null || len > arr.length) && (len = arr.length);
35
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
36
+ arr2[i] = arr[i];
37
+ return arr2;
38
+ }
39
+ function _array_with_holes(arr) {
40
+ if (Array.isArray(arr))
41
+ return arr;
42
+ }
43
+ function _array_without_holes(arr) {
44
+ if (Array.isArray(arr))
45
+ return _array_like_to_array(arr);
46
+ }
47
+ function _define_property(obj, key, value) {
48
+ return key in obj ? Object.defineProperty(obj, key, {
49
+ value,
50
+ enumerable: !0,
51
+ configurable: !0,
52
+ writable: !0
53
+ }) : obj[key] = value, obj;
54
+ }
55
+ function _iterable_to_array(iter) {
56
+ if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
57
+ return Array.from(iter);
58
+ }
59
+ function _iterable_to_array_limit(arr, i) {
60
+ var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
61
+ if (_i != null) {
62
+ var _arr = [], _n = !0, _d = !1, _s, _e;
63
+ try {
64
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
65
+ ;
66
+ } catch (err) {
67
+ _d = !0, _e = err;
68
+ } finally {
69
+ try {
70
+ !_n && _i.return != null && _i.return();
71
+ } finally {
72
+ if (_d)
73
+ throw _e;
57
74
  }
58
- );
75
+ }
76
+ return _arr;
77
+ }
78
+ }
79
+ function _non_iterable_rest() {
80
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
81
+ }
82
+ function _non_iterable_spread() {
83
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
84
+ }
85
+ function _object_spread(target) {
86
+ for (var i = 1; i < arguments.length; i++) {
87
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
88
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
89
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
90
+ }))), ownKeys2.forEach(function(key) {
91
+ _define_property(target, key, source[key]);
92
+ });
93
+ }
94
+ return target;
95
+ }
96
+ function ownKeys(object, enumerableOnly) {
97
+ var keys = Object.keys(object);
98
+ if (Object.getOwnPropertySymbols) {
99
+ var symbols = Object.getOwnPropertySymbols(object);
100
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
101
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
102
+ })), keys.push.apply(keys, symbols);
103
+ }
104
+ return keys;
105
+ }
106
+ function _object_spread_props(target, source) {
107
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
108
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
109
+ }), target;
110
+ }
111
+ function _object_without_properties(source, excluded) {
112
+ if (source == null)
113
+ return {};
114
+ var target = _object_without_properties_loose(source, excluded), key, i;
115
+ if (Object.getOwnPropertySymbols) {
116
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
117
+ for (i = 0; i < sourceSymbolKeys.length; i++)
118
+ key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
119
+ }
120
+ return target;
121
+ }
122
+ function _object_without_properties_loose(source, excluded) {
123
+ if (source == null)
124
+ return {};
125
+ var target = {}, sourceKeys = Object.keys(source), key, i;
126
+ for (i = 0; i < sourceKeys.length; i++)
127
+ key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
128
+ return target;
129
+ }
130
+ function _sliced_to_array(arr, i) {
131
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
132
+ }
133
+ function _to_consumable_array(arr) {
134
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
135
+ }
136
+ function _unsupported_iterable_to_array(o, minLen) {
137
+ if (o) {
138
+ if (typeof o == "string")
139
+ return _array_like_to_array(o, minLen);
140
+ var n = Object.prototype.toString.call(o).slice(8, -1);
141
+ if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
142
+ return Array.from(n);
143
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
144
+ return _array_like_to_array(o, minLen);
59
145
  }
60
- );
146
+ }
147
+ var VALUE_NAME = "SelectValue", SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
148
+ name: VALUE_NAME,
149
+ userSelect: "none"
150
+ }), SelectValue = SelectValueFrame.styleable(function(_param, forwardedRef) {
151
+ var __scopeSelect = _param.__scopeSelect, childrenProp = _param.children, placeholder = _param.placeholder, props = _object_without_properties(_param, [
152
+ "__scopeSelect",
153
+ "children",
154
+ "placeholder"
155
+ ]), context = (0, import_context.useSelectContext)(VALUE_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(VALUE_NAME, __scopeSelect), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange), children = childrenProp ?? context.selectedItem, isEmptyValue = context.value == null || context.value === "", selectValueChildren = isEmptyValue ? placeholder ?? children : children;
156
+ return /* @__PURE__ */ React.createElement(SelectValueFrame, _object_spread(_object_spread_props(_object_spread({}, !props.unstyled && {
157
+ size: itemParentContext.size,
158
+ ellipse: !0,
159
+ // we don't want events from the portalled `SelectValue` children to bubble
160
+ // through the item they came from
161
+ pointerEvents: "none"
162
+ }), {
163
+ ref: composedRefs
164
+ }), props), unwrapSelectItem(selectValueChildren));
165
+ });
61
166
  function unwrapSelectItem(selectValueChildren) {
62
- return React.Children.map(selectValueChildren, (child) => {
63
- var _a, _b, _c;
167
+ return React.Children.map(selectValueChildren, function(child) {
64
168
  if (child) {
65
- if (((_b = (_a = child.type) == null ? void 0 : _a.staticConfig) == null ? void 0 : _b.componentName) === import_SelectItemText.ITEM_TEXT_NAME)
169
+ var _child_type_staticConfig, _child_type, _child_props;
170
+ if (((_child_type = child.type) === null || _child_type === void 0 || (_child_type_staticConfig = _child_type.staticConfig) === null || _child_type_staticConfig === void 0 ? void 0 : _child_type_staticConfig.componentName) === import_SelectItemText.ITEM_TEXT_NAME)
66
171
  return child.props.children;
67
- if ((_c = child.props) != null && _c.children)
172
+ if (!((_child_props = child.props) === null || _child_props === void 0) && _child_props.children)
68
173
  return unwrapSelectItem(child.props.children);
69
174
  }
70
175
  return child;
71
176
  });
72
177
  }
73
- const SelectIcon = (0, import_core.styled)(import_stacks.XStack, {
178
+ var SelectIcon = (0, import_core.styled)(import_stacks.XStack, {
74
179
  name: "SelectIcon",
75
180
  // @ts-ignore
76
181
  "aria-hidden": !0,
77
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_text.Paragraph, { children: "\u25BC" })
182
+ children: /* @__PURE__ */ React.createElement(import_text.Paragraph, null, "\u25BC")
78
183
  }), ITEM_INDICATOR_NAME = "SelectItemIndicator", SelectItemIndicatorFrame = (0, import_core.styled)(import_stacks.XStack, {
79
184
  name: import_SelectItemText.ITEM_TEXT_NAME
80
- }), SelectItemIndicator = React.forwardRef(
81
- (props, forwardedRef) => {
82
- const { __scopeSelect, ...itemIndicatorProps } = props, context = (0, import_context.useSelectItemParentContext)(ITEM_INDICATOR_NAME, __scopeSelect), itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_INDICATOR_NAME, __scopeSelect);
83
- return context.shouldRenderWebNative ? null : itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, { "aria-hidden": !0, ...itemIndicatorProps, ref: forwardedRef }) : null;
84
- }
85
- );
185
+ }), SelectItemIndicator = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
186
+ var __scopeSelect = props.__scopeSelect, itemIndicatorProps = _object_without_properties(props, [
187
+ "__scopeSelect"
188
+ ]), context = (0, import_context.useSelectItemParentContext)(ITEM_INDICATOR_NAME, __scopeSelect), itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_INDICATOR_NAME, __scopeSelect);
189
+ return context.shouldRenderWebNative ? null : itemContext.isSelected ? /* @__PURE__ */ React.createElement(SelectItemIndicatorFrame, _object_spread_props(_object_spread({
190
+ "aria-hidden": !0
191
+ }, itemIndicatorProps), {
192
+ ref: forwardedRef
193
+ })) : null;
194
+ });
86
195
  SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
87
- const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupContext] = (0, import_context.createSelectContext)(GROUP_NAME), SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
196
+ var GROUP_NAME = "SelectGroup", _createSelectContext = _sliced_to_array((0, import_context.createSelectContext)(GROUP_NAME), 2), SelectGroupContextProvider = _createSelectContext[0], useSelectGroupContext = _createSelectContext[1], SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
88
197
  name: GROUP_NAME,
89
198
  width: "100%"
90
199
  }), NativeSelectTextFrame = (0, import_core.styled)(import_text.SizableText, {
@@ -102,10 +211,10 @@ const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupCon
102
211
  paddingRight: 10,
103
212
  variants: {
104
213
  size: {
105
- "...size": (val, extras) => {
106
- const { tokens } = extras, paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]);
214
+ "...size": function(val, extras) {
215
+ var tokens = extras.tokens, paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]), _tokens_radius_val;
107
216
  return {
108
- borderRadius: tokens.radius[val] ?? val,
217
+ borderRadius: (_tokens_radius_val = tokens.radius[val]) !== null && _tokens_radius_val !== void 0 ? _tokens_radius_val : val,
109
218
  minHeight: tokens.size[val],
110
219
  paddingRight: paddingHorizontal + 20,
111
220
  paddingLeft: paddingHorizontal,
@@ -119,212 +228,196 @@ const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupCon
119
228
  defaultVariants: {
120
229
  size: "$2"
121
230
  }
122
- }), SelectGroup = React.forwardRef(
123
- (props, forwardedRef) => {
124
- const { __scopeSelect, ...groupProps } = props, groupId = React.useId(), context = (0, import_context.useSelectContext)(GROUP_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(GROUP_NAME, __scopeSelect), size = itemParentContext.size ?? "$true", nativeSelectRef = React.useRef(null), content = itemParentContext.shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
- NativeSelectFrame,
126
- {
127
- asChild: !0,
128
- size,
129
- value: context.value,
130
- id: itemParentContext.id,
131
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
132
- NativeSelectTextFrame,
133
- {
134
- onChange: (event) => {
135
- itemParentContext.onChange(event.currentTarget.value);
136
- },
137
- size,
138
- ref: nativeSelectRef,
139
- style: {
140
- color: "var(--color)",
141
- // @ts-ignore
142
- appearance: "none"
143
- },
144
- children: props.children
145
- }
146
- )
147
- }
148
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
149
- SelectGroupFrame,
150
- {
151
- role: "group",
152
- "aria-labelledby": groupId,
153
- ...groupProps,
154
- ref: forwardedRef
231
+ }), SelectGroup = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
232
+ var __scopeSelect = props.__scopeSelect, groupProps = _object_without_properties(props, [
233
+ "__scopeSelect"
234
+ ]), groupId = React.useId(), context = (0, import_context.useSelectContext)(GROUP_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(GROUP_NAME, __scopeSelect), _itemParentContext_size, size = (_itemParentContext_size = itemParentContext.size) !== null && _itemParentContext_size !== void 0 ? _itemParentContext_size : "$true", nativeSelectRef = React.useRef(null), content = function() {
235
+ return itemParentContext.shouldRenderWebNative ? /* @__PURE__ */ React.createElement(NativeSelectFrame, {
236
+ asChild: !0,
237
+ size,
238
+ // @ts-expect-error until we support typing based on tag
239
+ value: context.value,
240
+ id: itemParentContext.id
241
+ }, /* @__PURE__ */ React.createElement(NativeSelectTextFrame, {
242
+ // @ts-ignore it's ok since tag="select"
243
+ onChange: function(event) {
244
+ itemParentContext.onChange(event.currentTarget.value);
245
+ },
246
+ size,
247
+ ref: nativeSelectRef,
248
+ style: {
249
+ color: "var(--color)",
250
+ // @ts-ignore
251
+ appearance: "none"
155
252
  }
156
- );
157
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId || "", children: content });
158
- }
159
- );
253
+ }, props.children)) : /* @__PURE__ */ React.createElement(SelectGroupFrame, _object_spread_props(_object_spread({
254
+ // @ts-ignore
255
+ role: "group",
256
+ "aria-labelledby": groupId
257
+ }, groupProps), {
258
+ ref: forwardedRef
259
+ }));
260
+ }();
261
+ return /* @__PURE__ */ React.createElement(SelectGroupContextProvider, {
262
+ scope: __scopeSelect,
263
+ id: groupId || ""
264
+ }, content);
265
+ });
160
266
  SelectGroup.displayName = GROUP_NAME;
161
- const LABEL_NAME = "SelectLabel", SelectLabel = React.forwardRef(
162
- (props, forwardedRef) => {
163
- const { __scopeSelect, ...labelProps } = props, context = (0, import_context.useSelectItemParentContext)(LABEL_NAME, __scopeSelect), groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
164
- return context.shouldRenderWebNative ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
165
- import_list_item.ListItem,
166
- {
167
- tag: "div",
168
- componentName: LABEL_NAME,
169
- fontWeight: "800",
170
- id: groupContext.id,
171
- size: context.size,
172
- ...labelProps,
173
- ref: forwardedRef
174
- }
175
- );
176
- }
177
- );
267
+ var LABEL_NAME = "SelectLabel", SelectLabel = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
268
+ var __scopeSelect = props.__scopeSelect, labelProps = _object_without_properties(props, [
269
+ "__scopeSelect"
270
+ ]), context = (0, import_context.useSelectItemParentContext)(LABEL_NAME, __scopeSelect), groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
271
+ return context.shouldRenderWebNative ? null : /* @__PURE__ */ React.createElement(import_list_item.ListItem, _object_spread_props(_object_spread({
272
+ tag: "div",
273
+ componentName: LABEL_NAME,
274
+ fontWeight: "800",
275
+ id: groupContext.id,
276
+ size: context.size
277
+ }, labelProps), {
278
+ ref: forwardedRef
279
+ }));
280
+ });
178
281
  SelectLabel.displayName = LABEL_NAME;
179
- const SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
282
+ var SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
180
283
  name: "SelectSeparator"
181
- }), SelectSheetController = (props) => {
182
- const context = (0, import_context.useSelectContext)("SelectSheetController", props.__scopeSelect), showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context), breakpointActive = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(context.sheetBreakpoint), getShowSheet = (0, import_core.useGet)(showSheet);
183
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
184
- import_sheet.SheetController,
185
- {
186
- onOpenChange: (val) => {
187
- getShowSheet() && props.onOpenChange(val);
188
- },
189
- open: context.open,
190
- hidden: breakpointActive === !1,
191
- children: props.children
192
- }
193
- );
194
- }, SelectSheetImpl = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children }), Select = (0, import_helpers.withStaticProperties)(
195
- (props) => {
196
- const {
197
- __scopeSelect,
198
- native,
199
- children,
200
- open: openProp,
201
- defaultOpen,
202
- onOpenChange,
203
- value: valueProp,
204
- defaultValue,
205
- onValueChange,
206
- disablePreventBodyScroll,
207
- size: sizeProp = "$true",
208
- onActiveChange,
209
- dir,
210
- id
211
- } = props, internalId = React.useId(), scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? internalId : internalId, { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
212
- Contents: React.useCallback(
213
- () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, { name: `${scopeKey}SheetContents` }),
214
- [scopeKey]
215
- )
216
- }), sheetBreakpoint = when, SelectImpl = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(sheetBreakpoint) || !import_constants.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl, forceUpdate = React.useReducer(() => ({}), {})[1], [selectedItem, setSelectedItem] = React.useState(null), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
217
- prop: openProp,
218
- defaultProp: defaultOpen || !1,
219
- onChange: onOpenChange
220
- }), [value, setValue] = (0, import_use_controllable_state.useControllableState)({
221
- prop: valueProp,
222
- defaultProp: defaultValue || "",
223
- onChange: onValueChange,
224
- transition: !0
225
- });
226
- React.useEffect(() => {
227
- open && emitValue(value);
228
- }, [open]), React.useEffect(() => {
229
- emitValue(value);
230
- }, [value]);
231
- const [activeIndex, setActiveIndex] = React.useState(0), [emitValue, valueSubscribe] = useEmitter(), [emitActiveIndex, activeIndexSubscribe] = useEmitter(), selectedIndexRef = React.useRef(null), activeIndexRef = React.useRef(null), listContentRef = React.useRef([]), [selectedIndex, setSelectedIndex] = React.useState(0), [valueNode, setValueNode] = React.useState(null);
232
- (0, import_constants.useIsomorphicLayoutEffect)(() => {
233
- selectedIndexRef.current = selectedIndex, activeIndexRef.current = activeIndex;
284
+ }), SelectSheetController = function(props) {
285
+ var context = (0, import_context.useSelectContext)("SelectSheetController", props.__scopeSelect), showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context), breakpointActive = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(context.sheetBreakpoint), getShowSheet = (0, import_core.useGet)(showSheet);
286
+ return /* @__PURE__ */ React.createElement(import_sheet.SheetController, {
287
+ onOpenChange: function(val) {
288
+ getShowSheet() && props.onOpenChange(val);
289
+ },
290
+ open: context.open,
291
+ hidden: breakpointActive === !1
292
+ }, props.children);
293
+ }, SelectSheetImpl = function(props) {
294
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, props.children);
295
+ }, Select = (0, import_helpers.withStaticProperties)(function(props) {
296
+ var __scopeSelect = props.__scopeSelect, native = props.native, children = props.children, openProp = props.open, defaultOpen = props.defaultOpen, onOpenChange = props.onOpenChange, valueProp = props.value, defaultValue = props.defaultValue, onValueChange = props.onValueChange, disablePreventBodyScroll = props.disablePreventBodyScroll, tmp = props.size, sizeProp = tmp === void 0 ? "$true" : tmp, onActiveChange = props.onActiveChange, dir = props.dir, id = props.id, internalId = React.useId(), _Object_keys_, scopeKey = __scopeSelect && (_Object_keys_ = Object.keys(__scopeSelect)[0]) !== null && _Object_keys_ !== void 0 ? _Object_keys_ : internalId, _useAdaptParent = (0, import_adapt.useAdaptParent)({
297
+ Contents: React.useCallback(function() {
298
+ return /* @__PURE__ */ React.createElement(import_portal.PortalHost, {
299
+ name: "".concat(scopeKey, "SheetContents")
300
+ });
301
+ }, [
302
+ scopeKey
303
+ ])
304
+ }), when = _useAdaptParent.when, AdaptProvider = _useAdaptParent.AdaptProvider, sheetBreakpoint = when, isSheet = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(sheetBreakpoint), SelectImpl = isSheet || !import_constants.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl, forceUpdate = React.useReducer(function() {
305
+ return {};
306
+ }, {})[1], _React_useState = _sliced_to_array(React.useState(null), 2), selectedItem = _React_useState[0], setSelectedItem = _React_useState[1], _useControllableState = _sliced_to_array((0, import_use_controllable_state.useControllableState)({
307
+ prop: openProp,
308
+ defaultProp: defaultOpen || !1,
309
+ onChange: onOpenChange
310
+ }), 2), open = _useControllableState[0], setOpen = _useControllableState[1], _useControllableState1 = _sliced_to_array((0, import_use_controllable_state.useControllableState)({
311
+ prop: valueProp,
312
+ defaultProp: defaultValue || "",
313
+ onChange: onValueChange,
314
+ transition: !0
315
+ }), 2), value = _useControllableState1[0], setValue = _useControllableState1[1];
316
+ React.useEffect(function() {
317
+ open && emitValue(value);
318
+ }, [
319
+ open
320
+ ]), React.useEffect(function() {
321
+ emitValue(value);
322
+ }, [
323
+ value
324
+ ]);
325
+ var _React_useState1 = _sliced_to_array(React.useState(0), 2), activeIndex = _React_useState1[0], setActiveIndex = _React_useState1[1], _useEmitter = _sliced_to_array(useEmitter(), 2), emitValue = _useEmitter[0], valueSubscribe = _useEmitter[1], _useEmitter1 = _sliced_to_array(useEmitter(), 2), emitActiveIndex = _useEmitter1[0], activeIndexSubscribe = _useEmitter1[1], selectedIndexRef = React.useRef(null), activeIndexRef = React.useRef(null), listContentRef = React.useRef([]), _React_useState2 = _sliced_to_array(React.useState(0), 2), selectedIndex = _React_useState2[0], setSelectedIndex = _React_useState2[1], _React_useState3 = _sliced_to_array(React.useState(null), 2), valueNode = _React_useState3[0], setValueNode = _React_useState3[1];
326
+ (0, import_constants.useIsomorphicLayoutEffect)(function() {
327
+ selectedIndexRef.current = selectedIndex, activeIndexRef.current = activeIndex;
328
+ });
329
+ var shouldRenderWebNative = import_constants.isWeb && (native === !0 || native === "web" || Array.isArray(native) && native.includes("web")), setActiveIndexDebounced = (0, import_use_debounce.useDebounce)(function(index) {
330
+ setActiveIndex(function(prev) {
331
+ return prev !== index ? (typeof index == "number" && emitActiveIndex(index), index) : prev;
234
332
  });
235
- const shouldRenderWebNative = import_constants.isWeb && (native === !0 || native === "web" || Array.isArray(native) && native.includes("web")), setActiveIndexDebounced = (0, import_use_debounce.useDebounce)(
236
- (index) => {
237
- setActiveIndex((prev) => prev !== index ? (typeof index == "number" && emitActiveIndex(index), index) : prev);
238
- },
239
- 1,
240
- {},
241
- []
242
- );
243
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
244
- import_context.SelectItemParentProvider,
245
- {
246
- scope: __scopeSelect,
247
- initialValue: React.useMemo(() => value, [open]),
248
- size: sizeProp,
249
- activeIndexSubscribe,
250
- valueSubscribe,
251
- setOpen,
252
- id,
253
- onChange: React.useCallback((val) => {
254
- setValue(val), emitValue(val);
255
- }, []),
256
- onActiveChange: (0, import_core.useEvent)((...args) => {
257
- onActiveChange == null || onActiveChange(...args);
258
- }),
259
- setSelectedIndex,
260
- setValueAtIndex: React.useCallback((index, value2) => {
261
- listContentRef.current[index] = value2;
262
- }, []),
263
- shouldRenderWebNative,
264
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
265
- import_context.SelectProvider,
266
- {
267
- scope: __scopeSelect,
268
- disablePreventBodyScroll,
269
- dir,
270
- blockSelection: !1,
271
- fallback: !1,
272
- selectedItem,
273
- setSelectedItem,
274
- forceUpdate,
275
- valueNode,
276
- onValueNodeChange: setValueNode,
277
- scopeKey,
278
- sheetBreakpoint,
279
- activeIndex,
280
- selectedIndex,
281
- setActiveIndex: setActiveIndexDebounced,
282
- value,
283
- open,
284
- native,
285
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectSheetController, { onOpenChange: setOpen, __scopeSelect, children: shouldRenderWebNative ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
286
- SelectImpl,
287
- {
288
- activeIndexRef,
289
- listContentRef,
290
- selectedIndexRef,
291
- ...props,
292
- open,
293
- value,
294
- children
295
- }
296
- ) })
297
- }
298
- )
299
- }
300
- ) });
301
- },
302
- {
303
- Adapt: import_adapt.Adapt,
304
- Content: import_SelectContent.SelectContent,
305
- Group: SelectGroup,
306
- Icon: SelectIcon,
307
- Item: import_SelectItem.SelectItem,
308
- ItemIndicator: SelectItemIndicator,
309
- ItemText: import_SelectItemText.SelectItemText,
310
- Label: SelectLabel,
311
- ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
312
- ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
313
- Trigger: import_SelectTrigger.SelectTrigger,
314
- Value: SelectValue,
315
- Viewport: import_SelectViewport.SelectViewport,
316
- Sheet: import_sheet.Sheet.Controlled
317
- }
318
- );
333
+ }, 1, {}, []);
334
+ return /* @__PURE__ */ React.createElement(AdaptProvider, null, /* @__PURE__ */ React.createElement(import_context.SelectItemParentProvider, {
335
+ scope: __scopeSelect,
336
+ initialValue: React.useMemo(function() {
337
+ return value;
338
+ }, [
339
+ open
340
+ ]),
341
+ size: sizeProp,
342
+ activeIndexSubscribe,
343
+ valueSubscribe,
344
+ setOpen,
345
+ id,
346
+ onChange: React.useCallback(function(val) {
347
+ setValue(val), emitValue(val);
348
+ }, []),
349
+ onActiveChange: (0, import_core.useEvent)(function() {
350
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
351
+ args[_key] = arguments[_key];
352
+ onActiveChange == null || onActiveChange.apply(void 0, _to_consumable_array(args));
353
+ }),
354
+ setSelectedIndex,
355
+ setValueAtIndex: React.useCallback(function(index, value2) {
356
+ listContentRef.current[index] = value2;
357
+ }, []),
358
+ shouldRenderWebNative
359
+ }, /* @__PURE__ */ React.createElement(import_context.SelectProvider, {
360
+ scope: __scopeSelect,
361
+ disablePreventBodyScroll,
362
+ dir,
363
+ blockSelection: !1,
364
+ fallback: !1,
365
+ selectedItem,
366
+ setSelectedItem,
367
+ forceUpdate,
368
+ valueNode,
369
+ onValueNodeChange: setValueNode,
370
+ scopeKey,
371
+ sheetBreakpoint,
372
+ activeIndex,
373
+ selectedIndex,
374
+ setActiveIndex: setActiveIndexDebounced,
375
+ value,
376
+ open,
377
+ native
378
+ }, /* @__PURE__ */ React.createElement(SelectSheetController, {
379
+ onOpenChange: setOpen,
380
+ __scopeSelect
381
+ }, shouldRenderWebNative ? children : /* @__PURE__ */ React.createElement(SelectImpl, _object_spread_props(_object_spread({
382
+ activeIndexRef,
383
+ listContentRef,
384
+ selectedIndexRef
385
+ }, props), {
386
+ open,
387
+ value
388
+ }), children)))));
389
+ }, {
390
+ Adapt: import_adapt.Adapt,
391
+ Content: import_SelectContent.SelectContent,
392
+ Group: SelectGroup,
393
+ Icon: SelectIcon,
394
+ Item: import_SelectItem.SelectItem,
395
+ ItemIndicator: SelectItemIndicator,
396
+ ItemText: import_SelectItemText.SelectItemText,
397
+ Label: SelectLabel,
398
+ ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
399
+ ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
400
+ Trigger: import_SelectTrigger.SelectTrigger,
401
+ Value: SelectValue,
402
+ Viewport: import_SelectViewport.SelectViewport,
403
+ Sheet: import_sheet.Sheet.Controlled
404
+ });
319
405
  function useEmitter() {
320
- const listeners = React.useRef();
406
+ var listeners = React.useRef();
321
407
  listeners.current || (listeners.current = /* @__PURE__ */ new Set());
322
- const emit = (value) => {
323
- listeners.current.forEach((l) => l(value));
324
- }, subscribe = React.useCallback((listener) => (listeners.current.add(listener), () => {
325
- listeners.current.delete(listener);
326
- }), []);
327
- return [emit, subscribe];
408
+ var emit = function(value) {
409
+ listeners.current.forEach(function(l) {
410
+ return l(value);
411
+ });
412
+ }, subscribe = React.useCallback(function(listener) {
413
+ return listeners.current.add(listener), function() {
414
+ listeners.current.delete(listener);
415
+ };
416
+ }, []);
417
+ return [
418
+ emit,
419
+ subscribe
420
+ ];
328
421
  }
329
422
  Select.displayName = import_constants2.SELECT_NAME;
330
423
  // Annotate the CommonJS export names for ESM import in node: