@tamagui/select 1.110.4 → 1.111.0
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.
- package/dist/cjs/Select.native.js +43 -157
- package/dist/cjs/Select.native.js.map +2 -2
- package/dist/cjs/SelectContent.native.js +1 -1
- package/dist/cjs/SelectContent.native.js.map +1 -1
- package/dist/cjs/SelectItem.native.js +32 -113
- package/dist/cjs/SelectItem.native.js.map +2 -2
- package/dist/cjs/SelectItemText.native.js +6 -61
- package/dist/cjs/SelectItemText.native.js.map +1 -1
- package/dist/cjs/SelectTrigger.native.js +22 -79
- package/dist/cjs/SelectTrigger.native.js.map +1 -1
- package/dist/cjs/SelectViewport.native.js +2 -2
- package/dist/cjs/SelectViewport.native.js.map +1 -1
- package/dist/cjs/context.native.js +10 -86
- package/dist/cjs/context.native.js.map +2 -2
- package/dist/esm/BubbleSelect.native.mjs +4 -0
- package/dist/esm/BubbleSelect.native.mjs.map +1 -0
- package/dist/esm/Select.native.js +43 -156
- package/dist/esm/Select.native.js.map +2 -2
- package/dist/esm/Select.native.mjs +397 -0
- package/dist/esm/Select.native.mjs.map +1 -0
- package/dist/esm/SelectContent.native.js +1 -1
- package/dist/esm/SelectContent.native.js.map +1 -1
- package/dist/esm/SelectContent.native.mjs +8 -0
- package/dist/esm/SelectContent.native.mjs.map +1 -0
- package/dist/esm/SelectImpl.native.mjs +8 -0
- package/dist/esm/SelectImpl.native.mjs.map +1 -0
- package/dist/esm/SelectItem.native.js +33 -113
- package/dist/esm/SelectItem.native.js.map +2 -2
- package/dist/esm/SelectItem.native.mjs +132 -0
- package/dist/esm/SelectItem.native.mjs.map +1 -0
- package/dist/esm/SelectItemText.native.js +5 -59
- package/dist/esm/SelectItemText.native.js.map +1 -1
- package/dist/esm/SelectItemText.native.mjs +55 -0
- package/dist/esm/SelectItemText.native.mjs.map +1 -0
- package/dist/esm/SelectScrollButton.native.mjs +8 -0
- package/dist/esm/SelectScrollButton.native.mjs.map +1 -0
- package/dist/esm/SelectTrigger.native.js +21 -77
- package/dist/esm/SelectTrigger.native.js.map +1 -1
- package/dist/esm/SelectTrigger.native.mjs +54 -0
- package/dist/esm/SelectTrigger.native.mjs.map +1 -0
- package/dist/esm/SelectViewport.native.js +2 -2
- package/dist/esm/SelectViewport.native.js.map +1 -1
- package/dist/esm/SelectViewport.native.mjs +35 -0
- package/dist/esm/SelectViewport.native.mjs.map +1 -0
- package/dist/esm/constants.native.mjs +9 -0
- package/dist/esm/constants.native.mjs.map +1 -0
- package/dist/esm/context.native.js +10 -85
- package/dist/esm/context.native.js.map +1 -1
- package/dist/esm/context.native.mjs +27 -0
- package/dist/esm/context.native.mjs.map +1 -0
- package/dist/esm/index.native.mjs +3 -0
- package/dist/esm/index.native.mjs.map +1 -0
- package/dist/esm/types.native.mjs +2 -0
- package/dist/esm/types.native.mjs.map +1 -0
- package/dist/esm/useSelectBreakpointActive.native.mjs +11 -0
- package/dist/esm/useSelectBreakpointActive.native.mjs.map +1 -0
- package/dist/jsx/Select.native.js +42 -155
- package/dist/jsx/Select.native.js.map +2 -2
- package/dist/jsx/SelectContent.native.js +1 -1
- package/dist/jsx/SelectContent.native.js.map +1 -1
- package/dist/jsx/SelectItem.native.js +32 -112
- package/dist/jsx/SelectItem.native.js.map +2 -2
- package/dist/jsx/SelectItemText.native.js +5 -59
- package/dist/jsx/SelectItemText.native.js.map +1 -1
- package/dist/jsx/SelectTrigger.native.js +21 -77
- package/dist/jsx/SelectTrigger.native.js.map +1 -1
- package/dist/jsx/SelectViewport.native.js +2 -2
- package/dist/jsx/SelectViewport.native.js.map +1 -1
- package/dist/jsx/context.native.js +10 -85
- package/dist/jsx/context.native.js.map +1 -1
- package/package.json +23 -23
|
@@ -29,131 +29,23 @@ __export(Select_exports, {
|
|
|
29
29
|
SelectSeparator: () => SelectSeparator
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(Select_exports);
|
|
32
|
-
var import_jsx_runtime = require("react/jsx-runtime"), 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_focusable = require("@tamagui/focusable"), 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++) arr2[i] = arr[i];
|
|
36
|
-
return arr2;
|
|
37
|
-
}
|
|
38
|
-
function _array_with_holes(arr) {
|
|
39
|
-
if (Array.isArray(arr)) return arr;
|
|
40
|
-
}
|
|
41
|
-
function _array_without_holes(arr) {
|
|
42
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
43
|
-
}
|
|
44
|
-
function _define_property(obj, key, value) {
|
|
45
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
46
|
-
value,
|
|
47
|
-
enumerable: !0,
|
|
48
|
-
configurable: !0,
|
|
49
|
-
writable: !0
|
|
50
|
-
}) : obj[key] = value, obj;
|
|
51
|
-
}
|
|
52
|
-
function _iterable_to_array(iter) {
|
|
53
|
-
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
54
|
-
}
|
|
55
|
-
function _iterable_to_array_limit(arr, i) {
|
|
56
|
-
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
57
|
-
if (_i != null) {
|
|
58
|
-
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
59
|
-
try {
|
|
60
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
61
|
-
;
|
|
62
|
-
} catch (err) {
|
|
63
|
-
_d = !0, _e = err;
|
|
64
|
-
} finally {
|
|
65
|
-
try {
|
|
66
|
-
!_n && _i.return != null && _i.return();
|
|
67
|
-
} finally {
|
|
68
|
-
if (_d) throw _e;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return _arr;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function _non_iterable_rest() {
|
|
75
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
76
|
-
}
|
|
77
|
-
function _non_iterable_spread() {
|
|
78
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
79
|
-
}
|
|
80
|
-
function _object_spread(target) {
|
|
81
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
82
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
83
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
84
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
85
|
-
}))), ownKeys2.forEach(function(key) {
|
|
86
|
-
_define_property(target, key, source[key]);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return target;
|
|
90
|
-
}
|
|
91
|
-
function ownKeys(object, enumerableOnly) {
|
|
92
|
-
var keys = Object.keys(object);
|
|
93
|
-
if (Object.getOwnPropertySymbols) {
|
|
94
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
95
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
96
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
97
|
-
})), keys.push.apply(keys, symbols);
|
|
98
|
-
}
|
|
99
|
-
return keys;
|
|
100
|
-
}
|
|
101
|
-
function _object_spread_props(target, source) {
|
|
102
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
103
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
104
|
-
}), target;
|
|
105
|
-
}
|
|
106
|
-
function _object_without_properties(source, excluded) {
|
|
107
|
-
if (source == null) return {};
|
|
108
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
109
|
-
if (Object.getOwnPropertySymbols) {
|
|
110
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
111
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
112
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
113
|
-
}
|
|
114
|
-
return target;
|
|
115
|
-
}
|
|
116
|
-
function _object_without_properties_loose(source, excluded) {
|
|
117
|
-
if (source == null) return {};
|
|
118
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
119
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
120
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
121
|
-
return target;
|
|
122
|
-
}
|
|
123
|
-
function _sliced_to_array(arr, i) {
|
|
124
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
125
|
-
}
|
|
126
|
-
function _to_consumable_array(arr) {
|
|
127
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
128
|
-
}
|
|
129
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
130
|
-
if (o) {
|
|
131
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
132
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
133
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
134
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
var VALUE_NAME = "SelectValue", SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime"), 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_focusable = require("@tamagui/focusable"), 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"), VALUE_NAME = "SelectValue", SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
138
33
|
name: VALUE_NAME,
|
|
139
34
|
userSelect: "none"
|
|
140
|
-
}), SelectValue = SelectValueFrame.styleable(function(
|
|
141
|
-
var __scopeSelect =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}), {
|
|
153
|
-
ref: composedRefs
|
|
154
|
-
}), props), {
|
|
35
|
+
}), SelectValue = SelectValueFrame.styleable(function(param, forwardedRef) {
|
|
36
|
+
var { __scopeSelect, children: childrenProp, placeholder, ...props } = param, 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;
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValueFrame, {
|
|
38
|
+
...!props.unstyled && {
|
|
39
|
+
size: itemParentContext.size,
|
|
40
|
+
ellipse: !0,
|
|
41
|
+
// we don't want events from the portalled `SelectValue` children to bubble
|
|
42
|
+
// through the item they came from
|
|
43
|
+
pointerEvents: "none"
|
|
44
|
+
},
|
|
45
|
+
ref: composedRefs,
|
|
46
|
+
...props,
|
|
155
47
|
children: unwrapSelectItem(selectValueChildren)
|
|
156
|
-
})
|
|
48
|
+
});
|
|
157
49
|
});
|
|
158
50
|
function unwrapSelectItem(selectValueChildren) {
|
|
159
51
|
return React.Children.map(selectValueChildren, function(child) {
|
|
@@ -177,17 +69,15 @@ var SelectIcon = (0, import_core.styled)(import_stacks.XStack, {
|
|
|
177
69
|
}), ITEM_INDICATOR_NAME = "SelectItemIndicator", SelectItemIndicatorFrame = (0, import_core.styled)(import_stacks.XStack, {
|
|
178
70
|
name: import_SelectItemText.ITEM_TEXT_NAME
|
|
179
71
|
}), SelectItemIndicator = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
180
|
-
var __scopeSelect = props.__scopeSelect,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
"aria-hidden": !0
|
|
185
|
-
}, itemIndicatorProps), {
|
|
72
|
+
var { __scopeSelect, ...itemIndicatorProps } = props, context = (0, import_context.useSelectItemParentContext)(ITEM_INDICATOR_NAME, __scopeSelect), itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
73
|
+
return context.shouldRenderWebNative ? null : itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, {
|
|
74
|
+
"aria-hidden": !0,
|
|
75
|
+
...itemIndicatorProps,
|
|
186
76
|
ref: forwardedRef
|
|
187
|
-
})
|
|
77
|
+
}) : null;
|
|
188
78
|
});
|
|
189
79
|
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
190
|
-
var GROUP_NAME = "SelectGroup",
|
|
80
|
+
var GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupContext] = (0, import_context.createSelectContext)(GROUP_NAME), SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
191
81
|
name: GROUP_NAME,
|
|
192
82
|
width: "100%"
|
|
193
83
|
}), NativeSelectTextFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
@@ -206,7 +96,7 @@ var GROUP_NAME = "SelectGroup", _createSelectContext = _sliced_to_array((0, impo
|
|
|
206
96
|
variants: {
|
|
207
97
|
size: {
|
|
208
98
|
"...size": function(val, extras) {
|
|
209
|
-
var tokens = extras
|
|
99
|
+
var { tokens } = extras, paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]), _tokens_radius_val;
|
|
210
100
|
return {
|
|
211
101
|
borderRadius: (_tokens_radius_val = tokens.radius[val]) !== null && _tokens_radius_val !== void 0 ? _tokens_radius_val : val,
|
|
212
102
|
minHeight: tokens.size[val],
|
|
@@ -223,9 +113,7 @@ var GROUP_NAME = "SelectGroup", _createSelectContext = _sliced_to_array((0, impo
|
|
|
223
113
|
size: "$2"
|
|
224
114
|
}
|
|
225
115
|
}), SelectGroup = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
226
|
-
var __scopeSelect = props.__scopeSelect,
|
|
227
|
-
"__scopeSelect"
|
|
228
|
-
]), 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() {
|
|
116
|
+
var { __scopeSelect, ...groupProps } = props, 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() {
|
|
229
117
|
return itemParentContext.shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeSelectFrame, {
|
|
230
118
|
asChild: !0,
|
|
231
119
|
size,
|
|
@@ -246,13 +134,13 @@ var GROUP_NAME = "SelectGroup", _createSelectContext = _sliced_to_array((0, impo
|
|
|
246
134
|
},
|
|
247
135
|
children: props.children
|
|
248
136
|
})
|
|
249
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupFrame,
|
|
137
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupFrame, {
|
|
250
138
|
// @ts-ignore
|
|
251
139
|
role: "group",
|
|
252
|
-
"aria-labelledby": groupId
|
|
253
|
-
|
|
140
|
+
"aria-labelledby": groupId,
|
|
141
|
+
...groupProps,
|
|
254
142
|
ref: forwardedRef
|
|
255
|
-
})
|
|
143
|
+
});
|
|
256
144
|
}();
|
|
257
145
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupContextProvider, {
|
|
258
146
|
scope: __scopeSelect,
|
|
@@ -262,18 +150,16 @@ var GROUP_NAME = "SelectGroup", _createSelectContext = _sliced_to_array((0, impo
|
|
|
262
150
|
});
|
|
263
151
|
SelectGroup.displayName = GROUP_NAME;
|
|
264
152
|
var LABEL_NAME = "SelectLabel", SelectLabel = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
265
|
-
var __scopeSelect = props.__scopeSelect,
|
|
266
|
-
|
|
267
|
-
]), context = (0, import_context.useSelectItemParentContext)(LABEL_NAME, __scopeSelect), groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
268
|
-
return context.shouldRenderWebNative ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItem, _object_spread_props(_object_spread({
|
|
153
|
+
var { __scopeSelect, ...labelProps } = props, context = (0, import_context.useSelectItemParentContext)(LABEL_NAME, __scopeSelect), groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
154
|
+
return context.shouldRenderWebNative ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItem, {
|
|
269
155
|
tag: "div",
|
|
270
156
|
componentName: LABEL_NAME,
|
|
271
157
|
fontWeight: "800",
|
|
272
158
|
id: groupContext.id,
|
|
273
|
-
size: context.size
|
|
274
|
-
|
|
159
|
+
size: context.size,
|
|
160
|
+
...labelProps,
|
|
275
161
|
ref: forwardedRef
|
|
276
|
-
})
|
|
162
|
+
});
|
|
277
163
|
});
|
|
278
164
|
SelectLabel.displayName = LABEL_NAME;
|
|
279
165
|
var SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
|
|
@@ -293,26 +179,26 @@ var SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
|
|
|
293
179
|
children: props.children
|
|
294
180
|
});
|
|
295
181
|
}, Select = (0, import_helpers.withStaticProperties)(function(props) {
|
|
296
|
-
var
|
|
182
|
+
var { __scopeSelect, native, children, open: openProp, defaultOpen, onOpenChange, value: valueProp, defaultValue, onValueChange, disablePreventBodyScroll, size: sizeProp = "$true", onActiveChange, dir, id } = props, internalId = React.useId(), _Object_keys_, scopeKey = __scopeSelect && (_Object_keys_ = Object.keys(__scopeSelect)[0]) !== null && _Object_keys_ !== void 0 ? _Object_keys_ : internalId, { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
|
|
297
183
|
Contents: React.useCallback(function() {
|
|
298
184
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, {
|
|
299
|
-
name:
|
|
185
|
+
name: `${scopeKey}SheetContents`
|
|
300
186
|
});
|
|
301
187
|
}, [
|
|
302
188
|
scopeKey
|
|
303
189
|
])
|
|
304
|
-
}),
|
|
190
|
+
}), sheetBreakpoint = when, isSheet = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(sheetBreakpoint), SelectImpl = isSheet || !import_constants.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl, forceUpdate = React.useReducer(function() {
|
|
305
191
|
return {};
|
|
306
|
-
}, {})[1],
|
|
192
|
+
}, {})[1], [selectedItem, setSelectedItem] = React.useState(null), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
307
193
|
prop: openProp,
|
|
308
194
|
defaultProp: defaultOpen || !1,
|
|
309
195
|
onChange: onOpenChange
|
|
310
|
-
}),
|
|
196
|
+
}), [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
311
197
|
prop: valueProp,
|
|
312
198
|
defaultProp: defaultValue || "",
|
|
313
199
|
onChange: onValueChange,
|
|
314
200
|
transition: !0
|
|
315
|
-
})
|
|
201
|
+
});
|
|
316
202
|
React.useEffect(function() {
|
|
317
203
|
open && emitValue(value);
|
|
318
204
|
}, [
|
|
@@ -335,7 +221,7 @@ var SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
|
|
|
335
221
|
}, [
|
|
336
222
|
props.id
|
|
337
223
|
]);
|
|
338
|
-
var
|
|
224
|
+
var [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);
|
|
339
225
|
(0, import_constants.useIsomorphicLayoutEffect)(function() {
|
|
340
226
|
selectedIndexRef.current = selectedIndex, activeIndexRef.current = activeIndex;
|
|
341
227
|
});
|
|
@@ -363,7 +249,7 @@ var SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
|
|
|
363
249
|
onActiveChange: (0, import_core.useEvent)(function() {
|
|
364
250
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
|
|
365
251
|
args[_key] = arguments[_key];
|
|
366
|
-
onActiveChange == null || onActiveChange
|
|
252
|
+
onActiveChange == null || onActiveChange(...args);
|
|
367
253
|
}),
|
|
368
254
|
setSelectedIndex,
|
|
369
255
|
setValueAtIndex: React.useCallback(function(index, value2) {
|
|
@@ -392,15 +278,15 @@ var SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
|
|
|
392
278
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectSheetController, {
|
|
393
279
|
onOpenChange: setOpen,
|
|
394
280
|
__scopeSelect,
|
|
395
|
-
children: shouldRenderWebNative ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectImpl,
|
|
281
|
+
children: shouldRenderWebNative ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectImpl, {
|
|
396
282
|
activeIndexRef,
|
|
397
283
|
listContentRef,
|
|
398
|
-
selectedIndexRef
|
|
399
|
-
|
|
284
|
+
selectedIndexRef,
|
|
285
|
+
...props,
|
|
400
286
|
open,
|
|
401
287
|
value,
|
|
402
288
|
children
|
|
403
|
-
})
|
|
289
|
+
})
|
|
404
290
|
})
|
|
405
291
|
})
|
|
406
292
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/select/src/Select.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAsC,2BACtC,sBAAgC,kCAChC,mBAAiD,+BAEjD,cAA2D,0BAC3D,mBAAyB,+BACzB,iBAAqC,6BAErC,mBAAyB,+BACzB,gBAA2B,4BAC3B,mBAA0B,+BAC1B,mBAAkC,+BAClC,eAAuC,2BACvC,gBAA+C,4BAC/C,cAAuC,0BACvC,gCAAqC,4CACrC,QAAuB,2BACvB,sBAA4B,kCAE5BA,oBAA4B,wBAC5B,iBAMO,sBACP,uBAA8B,4BAC9B,oBAAiC,yBACjC,oBAAiD,yBACjD,wBAA+C,6BAC/C,4BAA6D,iCAC7D,uBAA8B,4BAC9B,wBAA+B,6BAE/B,mCAGO
|
|
5
|
-
"names": ["import_constants", "VALUE_NAME", "SelectValueFrame", "styled", "SizableText", "name", "userSelect", "SelectValue", "styleable", "forwardedRef", "__scopeSelect", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAsC,2BACtC,sBAAgC,kCAChC,mBAAiD,+BAEjD,cAA2D,0BAC3D,mBAAyB,+BACzB,iBAAqC,6BAErC,mBAAyB,+BACzB,gBAA2B,4BAC3B,mBAA0B,+BAC1B,mBAAkC,+BAClC,eAAuC,2BACvC,gBAA+C,4BAC/C,cAAuC,0BACvC,gCAAqC,4CACrC,QAAuB,2BACvB,sBAA4B,kCAE5BA,oBAA4B,wBAC5B,iBAMO,sBACP,uBAA8B,4BAC9B,oBAAiC,yBACjC,oBAAiD,yBACjD,wBAA+C,6BAC/C,4BAA6D,iCAC7D,uBAA8B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;QAChBlK;QACAmG;QACAM;kBAEA,uCAAAvG,KAACuF,uBAAAA;UAAsBS,cAAcmC;UAASnJ;oBAC3CyC,wBACCxC,WAEA,uCAAAe,KAAC4H,YAAAA;YACCyB;YACAC;YACAF;YACC,GAAGhK;YACJ6G;YACAnG;;;;;;;AAUhB,GACA;EACE+K;EACAC,SAASC;EACTC,OAAOnH;EACPoH,MAAMlK;EACNmK,MAAMC;EACNC,eAAehK;EACfiK,UAAUC;EACVC,OAAOvG;EACPwG,kBAAkBC;EAClBC,gBAAgBC;EAChBC,SAASC;EACTC,OAAOjN;EACPkN,UAAUC;EACVC,OAAOA,mBAAMC;AACf,CAAA;AAGF,SAASjD,aAAAA;AACP,MAAMkD,YAAY5L,MAAM2D,OAAM;AAC9B,EAAKiI,UAAUvC,YACbuC,UAAUvC,UAAU,oBAAIwC,IAAAA;AAE1B,MAAMC,OAAO,SAACvM,OAAAA;AACZqM,cAAUvC,QAAS0C,QAAQ,SAACC,GAAAA;aAAMA,EAAEzM,KAAAA;;EACtC,GACM0M,YAAYjM,MAAMkH,YAAY,SAACgF,UAAAA;AACnCN,qBAAUvC,QAAS8C,IAAID,QAAAA,GAChB,WAAA;AACLN,gBAAUvC,QAAS+C,OAAOF,QAAAA;IAC5B;EACF,GAAG,CAAA,CAAE;AACL,SAAO;IAACJ;IAAMG;;AAChB;AAGAnG,OAAOzE,cAAcgL;",
|
|
5
|
+
"names": ["import_constants", "VALUE_NAME", "SelectValueFrame", "styled", "SizableText", "name", "userSelect", "SelectValue", "styleable", "forwardedRef", "__scopeSelect", "children", "childrenProp", "placeholder", "props", "context", "useSelectContext", "itemParentContext", "useSelectItemParentContext", "composedRefs", "useComposedRefs", "onValueNodeChange", "selectedItem", "isEmptyValue", "value", "selectValueChildren", "_jsx", "unstyled", "size", "ellipse", "pointerEvents", "ref", "unwrapSelectItem", "React", "Children", "map", "child", "type", "staticConfig", "componentName", "ITEM_TEXT_NAME", "SelectIcon", "XStack", "Paragraph", "ITEM_INDICATOR_NAME", "SelectItemIndicatorFrame", "SelectItemIndicator", "forwardRef", "itemIndicatorProps", "itemContext", "useSelectItemContext", "shouldRenderWebNative", "isSelected", "aria-hidden", "displayName", "GROUP_NAME", "SelectGroupContextProvider", "useSelectGroupContext", "createSelectContext", "SelectGroupFrame", "YStack", "width", "NativeSelectTextFrame", "tag", "backgroundColor", "borderColor", "hoverStyle", "NativeSelectFrame", "ThemeableStack", "bordered", "outlineWidth", "paddingRight", "variants", "val", "extras", "tokens", "paddingHorizontal", "getVariableValue", "space", "borderRadius", "radius", "minHeight", "paddingLeft", "paddingVertical", "getSpace", "shift", "defaultVariants", "SelectGroup", "groupProps", "groupId", "useId", "nativeSelectRef", "useRef", "content", "asChild", "id", "onChange", "event", "currentTarget", "style", "color", "appearance", "role", "aria-labelledby", "scope", "LABEL_NAME", "SelectLabel", "labelProps", "groupContext", "ListItem", "fontWeight", "SelectSeparator", "Separator", "SelectSheetController", "showSheet", "useShowSelectSheet", "breakpointActive", "useSelectBreakpointActive", "sheetBreakpoint", "getShowSheet", "useGet", "SheetController", "onOpenChange", "open", "hidden", "SelectSheetImpl", "_Fragment", "Select", "withStaticProperties", "native", "openProp", "defaultOpen", "valueProp", "defaultValue", "onValueChange", "disablePreventBodyScroll", "sizeProp", "onActiveChange", "dir", "internalId", "Object", "scopeKey", "keys", "when", "AdaptProvider", "useAdaptParent", "Contents", "useCallback", "PortalHost", "isSheet", "SelectImpl", "isWeb", "SelectInlineImpl", "forceUpdate", "useReducer", "setSelectedItem", "useState", "setOpen", "useControllableState", "prop", "defaultProp", "setValue", "transition", "useEffect", "emitValue", "registerFocusable", "focusAndSelect", "focus", "activeIndex", "setActiveIndex", "valueSubscribe", "useEmitter", "emitActiveIndex", "activeIndexSubscribe", "selectedIndexRef", "activeIndexRef", "listContentRef", "selectedIndex", "setSelectedIndex", "valueNode", "setValueNode", "useIsomorphicLayoutEffect", "current", "Array", "isArray", "includes", "setActiveIndexDebounced", "useDebounce", "index", "prev", "SelectItemParentProvider", "initialValue", "useMemo", "useEvent", "args", "setValueAtIndex", "SelectProvider", "blockSelection", "fallback", "Adapt", "Content", "SelectContent", "Group", "Icon", "Item", "SelectItem", "ItemIndicator", "ItemText", "SelectItemText", "Label", "ScrollDownButton", "SelectScrollDownButton", "ScrollUpButton", "SelectScrollUpButton", "Trigger", "SelectTrigger", "Value", "Viewport", "SelectViewport", "Sheet", "Controlled", "listeners", "Set", "emit", "forEach", "l", "subscribe", "listener", "add", "delete", "SELECT_NAME"]
|
|
6
6
|
}
|
|
@@ -19,7 +19,7 @@ __export(SelectContent_native_exports, {
|
|
|
19
19
|
});
|
|
20
20
|
module.exports = __toCommonJS(SelectContent_native_exports);
|
|
21
21
|
var SelectContent = function(param) {
|
|
22
|
-
var children = param
|
|
22
|
+
var { children } = param;
|
|
23
23
|
return children;
|
|
24
24
|
};
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/select/src/SelectContent.native.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAEA;;;;;AAAO,IAAMA,gBAAgB,SAAA,OAAA;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAEA;;;;;AAAO,IAAMA,gBAAgB,SAAA,OAAA;MAAC,EAAEC,SAAQ,IAAsB;AAC5D,SAAOA;AACT;",
|
|
5
5
|
"names": ["SelectContent", "children"]
|
|
6
6
|
}
|
|
@@ -28,97 +28,13 @@ __export(SelectItem_exports, {
|
|
|
28
28
|
useSelectItemContext: () => useSelectItemContext
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(SelectItem_exports);
|
|
31
|
-
var import_jsx_runtime = require("react/jsx-runtime"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_list_item = require("@tamagui/list-item"), React = __toESM(require("react")), import_context = require("./context")
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (Array.isArray(arr)) return arr;
|
|
39
|
-
}
|
|
40
|
-
function _define_property(obj, key, value) {
|
|
41
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
42
|
-
value,
|
|
43
|
-
enumerable: !0,
|
|
44
|
-
configurable: !0,
|
|
45
|
-
writable: !0
|
|
46
|
-
}) : obj[key] = value, obj;
|
|
47
|
-
}
|
|
48
|
-
function _instanceof(left, right) {
|
|
49
|
-
return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
|
|
50
|
-
}
|
|
51
|
-
function _iterable_to_array_limit(arr, i) {
|
|
52
|
-
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
53
|
-
if (_i != null) {
|
|
54
|
-
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
55
|
-
try {
|
|
56
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
57
|
-
;
|
|
58
|
-
} catch (err) {
|
|
59
|
-
_d = !0, _e = err;
|
|
60
|
-
} finally {
|
|
61
|
-
try {
|
|
62
|
-
!_n && _i.return != null && _i.return();
|
|
63
|
-
} finally {
|
|
64
|
-
if (_d) throw _e;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return _arr;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function _non_iterable_rest() {
|
|
71
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
72
|
-
}
|
|
73
|
-
function _object_spread(target) {
|
|
74
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
75
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys = Object.keys(source);
|
|
76
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
77
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
78
|
-
}))), ownKeys.forEach(function(key) {
|
|
79
|
-
_define_property(target, key, source[key]);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return target;
|
|
83
|
-
}
|
|
84
|
-
function _object_without_properties(source, excluded) {
|
|
85
|
-
if (source == null) return {};
|
|
86
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
87
|
-
if (Object.getOwnPropertySymbols) {
|
|
88
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
89
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
90
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
91
|
-
}
|
|
92
|
-
return target;
|
|
93
|
-
}
|
|
94
|
-
function _object_without_properties_loose(source, excluded) {
|
|
95
|
-
if (source == null) return {};
|
|
96
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
97
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
98
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
99
|
-
return target;
|
|
100
|
-
}
|
|
101
|
-
function _sliced_to_array(arr, i) {
|
|
102
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
103
|
-
}
|
|
104
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
105
|
-
if (o) {
|
|
106
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
107
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
108
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
109
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
var ITEM_NAME = "SelectItem", _createSelectContext = _sliced_to_array((0, import_context.createSelectContext)(ITEM_NAME), 2), SelectItemContextProvider = _createSelectContext[0], useSelectItemContext = _createSelectContext[1], SelectItem = import_list_item.ListItemFrame.styleable(function(props, forwardedRef) {
|
|
113
|
-
var __scopeSelect = props.__scopeSelect, value = props.value, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? !1 : _props_disabled, textValueProp = props.textValue, index = props.index, restProps = _object_without_properties(props, [
|
|
114
|
-
"__scopeSelect",
|
|
115
|
-
"value",
|
|
116
|
-
"disabled",
|
|
117
|
-
"textValue",
|
|
118
|
-
"index"
|
|
119
|
-
]), _useListItem = (0, import_list_item.useListItem)(_object_spread({}, !props.unstyled && {
|
|
120
|
-
ellipse: !0
|
|
121
|
-
}, restProps)), listItemProps = _useListItem.props, context = (0, import_context.useSelectItemParentContext)(ITEM_NAME, __scopeSelect), setSelectedIndex = context.setSelectedIndex, listRef = context.listRef, setOpen = context.setOpen, onChange = context.onChange, activeIndexSubscribe = context.activeIndexSubscribe, valueSubscribe = context.valueSubscribe, allowMouseUpRef = context.allowMouseUpRef, allowSelectRef = context.allowSelectRef, setValueAtIndex = context.setValueAtIndex, selectTimeoutRef = context.selectTimeoutRef, dataRef = context.dataRef, interactions = context.interactions, shouldRenderWebNative = context.shouldRenderWebNative, size = context.size, onActiveChange = context.onActiveChange, initialValue = context.initialValue, _React_useState = _sliced_to_array(React.useState(initialValue === value), 2), isSelected = _React_useState[0], setSelected = _React_useState[1];
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_list_item = require("@tamagui/list-item"), React = __toESM(require("react")), import_context = require("./context"), ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext] = (0, import_context.createSelectContext)(ITEM_NAME), SelectItem = import_list_item.ListItemFrame.styleable(function(props, forwardedRef) {
|
|
32
|
+
var { __scopeSelect, value, disabled = !1, textValue: textValueProp, index, ...restProps } = props, { props: listItemProps } = (0, import_list_item.useListItem)({
|
|
33
|
+
...!props.unstyled && {
|
|
34
|
+
ellipse: !0
|
|
35
|
+
},
|
|
36
|
+
...restProps
|
|
37
|
+
}), context = (0, import_context.useSelectItemParentContext)(ITEM_NAME, __scopeSelect), { setSelectedIndex, listRef, setOpen, onChange, activeIndexSubscribe, valueSubscribe, allowMouseUpRef, allowSelectRef, setValueAtIndex, selectTimeoutRef, dataRef, interactions, shouldRenderWebNative, size, onActiveChange, initialValue } = context, [isSelected, setSelected] = React.useState(initialValue === value);
|
|
122
38
|
React.useEffect(function() {
|
|
123
39
|
return activeIndexSubscribe(function(i) {
|
|
124
40
|
var isActive = index === i;
|
|
@@ -137,7 +53,7 @@ var ITEM_NAME = "SelectItem", _createSelectContext = _sliced_to_array((0, import
|
|
|
137
53
|
value
|
|
138
54
|
]);
|
|
139
55
|
var textId = React.useId(), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, function(node) {
|
|
140
|
-
import_constants.isWeb &&
|
|
56
|
+
import_constants.isWeb && node instanceof HTMLElement && listRef && (listRef.current[index] = node);
|
|
141
57
|
});
|
|
142
58
|
(0, import_constants.useIsomorphicLayoutEffect)(function() {
|
|
143
59
|
setValueAtIndex(index, value);
|
|
@@ -151,19 +67,19 @@ var ITEM_NAME = "SelectItem", _createSelectContext = _sliced_to_array((0, import
|
|
|
151
67
|
}
|
|
152
68
|
var selectItemProps = React.useMemo(function() {
|
|
153
69
|
return interactions ? interactions.getItemProps({
|
|
154
|
-
onTouchMove
|
|
70
|
+
onTouchMove() {
|
|
155
71
|
allowSelectRef.current = !0, allowMouseUpRef.current = !1;
|
|
156
72
|
},
|
|
157
|
-
onTouchEnd
|
|
73
|
+
onTouchEnd() {
|
|
158
74
|
allowSelectRef.current = !1, allowMouseUpRef.current = !0;
|
|
159
75
|
},
|
|
160
|
-
onKeyDown
|
|
76
|
+
onKeyDown(event) {
|
|
161
77
|
event.key === "Enter" || event.key === " " && !(dataRef != null && dataRef.current.typing) ? (event.preventDefault(), handleSelect()) : allowSelectRef.current = !0;
|
|
162
78
|
},
|
|
163
|
-
onClick
|
|
79
|
+
onClick() {
|
|
164
80
|
allowSelectRef.current && handleSelect();
|
|
165
81
|
},
|
|
166
|
-
onMouseUp
|
|
82
|
+
onMouseUp() {
|
|
167
83
|
allowMouseUpRef.current && (allowSelectRef.current && handleSelect(), clearTimeout(selectTimeoutRef.current), selectTimeoutRef.current = setTimeout(function() {
|
|
168
84
|
allowSelectRef.current = !0;
|
|
169
85
|
}));
|
|
@@ -182,7 +98,7 @@ var ITEM_NAME = "SelectItem", _createSelectContext = _sliced_to_array((0, import
|
|
|
182
98
|
children: shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
183
99
|
value,
|
|
184
100
|
children: props.children
|
|
185
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItemFrame,
|
|
101
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_item.ListItemFrame, {
|
|
186
102
|
tag: "div",
|
|
187
103
|
componentName: ITEM_NAME,
|
|
188
104
|
ref: composedRefs,
|
|
@@ -191,21 +107,24 @@ var ITEM_NAME = "SelectItem", _createSelectContext = _sliced_to_array((0, import
|
|
|
191
107
|
"data-state": isSelected ? "active" : "inactive",
|
|
192
108
|
"aria-disabled": disabled || void 0,
|
|
193
109
|
"data-disabled": disabled ? "" : void 0,
|
|
194
|
-
tabIndex: disabled ? void 0 : -1
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
110
|
+
tabIndex: disabled ? void 0 : -1,
|
|
111
|
+
...!props.unstyled && {
|
|
112
|
+
backgrounded: !0,
|
|
113
|
+
pressTheme: !0,
|
|
114
|
+
hoverTheme: !0,
|
|
115
|
+
focusTheme: !0,
|
|
116
|
+
cursor: "default",
|
|
117
|
+
size,
|
|
118
|
+
outlineOffset: -0.5,
|
|
119
|
+
focusVisibleStyle: {
|
|
120
|
+
outlineColor: "$outlineColor",
|
|
121
|
+
outlineWidth: 1,
|
|
122
|
+
outlineStyle: "solid"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
...listItemProps,
|
|
126
|
+
...selectItemProps
|
|
127
|
+
})
|
|
209
128
|
});
|
|
210
129
|
}, {
|
|
211
130
|
disableTheme: !0
|