@tamagui/select 1.0.0-beta.11
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.js +451 -0
- package/dist/cjs/Select.js.map +7 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/Select.js +391 -0
- package/dist/esm/Select.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/jsx/Select.js +301 -0
- package/dist/jsx/index.js +1 -0
- package/package.json +48 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import {
|
|
4
|
+
offset,
|
|
5
|
+
useFloating
|
|
6
|
+
} from "@floating-ui/react-dom-interactions";
|
|
7
|
+
import { usePrevious } from "@radix-ui/react-use-previous";
|
|
8
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
9
|
+
import { composeEventHandlers, useIsomorphicLayoutEffect } from "@tamagui/core";
|
|
10
|
+
import { useId } from "@tamagui/core";
|
|
11
|
+
import { createContextScope } from "@tamagui/create-context";
|
|
12
|
+
import { Separator } from "@tamagui/separator";
|
|
13
|
+
import { XStack } from "@tamagui/stacks";
|
|
14
|
+
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
15
|
+
import * as React from "react";
|
|
16
|
+
import * as ReactDOM from "react-dom";
|
|
17
|
+
const OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
18
|
+
const SELECTION_KEYS = [" ", "Enter"];
|
|
19
|
+
const SELECT_NAME = "Select";
|
|
20
|
+
const WINDOW_PADDING = 8;
|
|
21
|
+
const SCROLL_ARROW_VELOCITY = 8;
|
|
22
|
+
const SCROLL_ARROW_THRESHOLD = 8;
|
|
23
|
+
const MIN_HEIGHT = 80;
|
|
24
|
+
const FALLBACK_THRESHOLD = 16;
|
|
25
|
+
const [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME);
|
|
26
|
+
const [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
27
|
+
const Select = /* @__PURE__ */ __name((props) => {
|
|
28
|
+
const {
|
|
29
|
+
__scopeSelect,
|
|
30
|
+
children,
|
|
31
|
+
open: openProp,
|
|
32
|
+
defaultOpen,
|
|
33
|
+
onOpenChange,
|
|
34
|
+
value: valueProp,
|
|
35
|
+
defaultValue,
|
|
36
|
+
onValueChange,
|
|
37
|
+
dir: dir2,
|
|
38
|
+
name,
|
|
39
|
+
autoComplete
|
|
40
|
+
} = props;
|
|
41
|
+
const [open, setOpen] = useControllableState({
|
|
42
|
+
prop: openProp,
|
|
43
|
+
defaultProp: defaultOpen || false,
|
|
44
|
+
onChange: onOpenChange
|
|
45
|
+
});
|
|
46
|
+
const [value, setValue] = useControllableState({
|
|
47
|
+
prop: valueProp,
|
|
48
|
+
defaultProp: defaultValue || "",
|
|
49
|
+
onChange: onValueChange
|
|
50
|
+
});
|
|
51
|
+
const selectedIndexRef = React.useRef(null);
|
|
52
|
+
const activeIndexRef = React.useRef(null);
|
|
53
|
+
const prevActiveIndex = usePrevious(activeIndex);
|
|
54
|
+
const [showArrows, setShowArrows] = React.useState(false);
|
|
55
|
+
const [scrollTop, setScrollTop] = React.useState(0);
|
|
56
|
+
const [activeIndex, setActiveIndex] = React.useState(null);
|
|
57
|
+
const [selectedIndex, setSelectedIndex] = React.useState(Math.max(0, listContentRef.current.indexOf(value)));
|
|
58
|
+
useIsomorphicLayoutEffect(() => {
|
|
59
|
+
selectedIndexRef.current = selectedIndex;
|
|
60
|
+
activeIndexRef.current = activeIndex;
|
|
61
|
+
});
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const frame = requestAnimationFrame(() => {
|
|
64
|
+
setShowArrows(open);
|
|
65
|
+
if (!open) {
|
|
66
|
+
setScrollTop(0);
|
|
67
|
+
setMiddlewareType("align");
|
|
68
|
+
setActiveIndex(null);
|
|
69
|
+
setControlledScrolling(false);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return () => cancelAnimationFrame(frame);
|
|
73
|
+
}, [open]);
|
|
74
|
+
const showUpArrow = showArrows && scrollTop > SCROLL_ARROW_THRESHOLD;
|
|
75
|
+
const showDownArrow = showArrows && floatingRef.current && scrollTop < floatingRef.current.scrollHeight - floatingRef.current.clientHeight - SCROLL_ARROW_THRESHOLD;
|
|
76
|
+
return /* @__PURE__ */ React.createElement(SelectProvider, {
|
|
77
|
+
scope: __scopeSelect,
|
|
78
|
+
open
|
|
79
|
+
}, children);
|
|
80
|
+
}, "Select");
|
|
81
|
+
Select.displayName = SELECT_NAME;
|
|
82
|
+
const TRIGGER_NAME = "SelectTrigger";
|
|
83
|
+
const SelectTrigger = React.forwardRef((props, forwardedRef) => {
|
|
84
|
+
const {
|
|
85
|
+
__scopeSelect,
|
|
86
|
+
disabled = false,
|
|
87
|
+
"aria-labelledby": ariaLabelledby,
|
|
88
|
+
...triggerProps
|
|
89
|
+
} = props;
|
|
90
|
+
const context = useSelectContext(TRIGGER_NAME, __scopeSelect);
|
|
91
|
+
const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);
|
|
92
|
+
const getItems = useCollection(__scopeSelect);
|
|
93
|
+
const handleOpen = /* @__PURE__ */ __name(() => {
|
|
94
|
+
if (!disabled) {
|
|
95
|
+
context.onOpenChange(true);
|
|
96
|
+
resetTypeahead();
|
|
97
|
+
}
|
|
98
|
+
}, "handleOpen");
|
|
99
|
+
return /* @__PURE__ */ React.createElement(Primitive.button, {
|
|
100
|
+
type: "button",
|
|
101
|
+
role: "combobox",
|
|
102
|
+
"aria-controls": context.contentId,
|
|
103
|
+
"aria-expanded": context.open,
|
|
104
|
+
"aria-autocomplete": "none",
|
|
105
|
+
dir: context.dir,
|
|
106
|
+
disabled,
|
|
107
|
+
"data-disabled": disabled ? "" : void 0,
|
|
108
|
+
...triggerProps,
|
|
109
|
+
ref: composedRefs,
|
|
110
|
+
onPointerDown: composeEventHandlers(triggerProps.onPointerDown, (event) => {
|
|
111
|
+
;
|
|
112
|
+
event.target.releasePointerCapture(event.pointerId);
|
|
113
|
+
if (event.button === 0 && event.ctrlKey === false) {
|
|
114
|
+
handleOpen();
|
|
115
|
+
context.triggerPointerDownPosRef.current = {
|
|
116
|
+
x: Math.round(event.pageX),
|
|
117
|
+
y: Math.round(event.pageY)
|
|
118
|
+
};
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {
|
|
123
|
+
const isTypingAhead = searchRef.current !== "";
|
|
124
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
125
|
+
if (!isModifierKey && event.key.length === 1)
|
|
126
|
+
handleTypeaheadSearch(event.key);
|
|
127
|
+
if (isTypingAhead && event.key === " ")
|
|
128
|
+
return;
|
|
129
|
+
if (OPEN_KEYS.includes(event.key)) {
|
|
130
|
+
handleOpen();
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
SelectTrigger.displayName = TRIGGER_NAME;
|
|
137
|
+
const VALUE_NAME = "SelectValue";
|
|
138
|
+
const SelectValue = React.forwardRef((props, forwardedRef) => {
|
|
139
|
+
const { __scopeSelect, className, style, ...valueProps } = props;
|
|
140
|
+
return /* @__PURE__ */ React.createElement(XStack, {
|
|
141
|
+
...valueProps,
|
|
142
|
+
pointerEvents: "none"
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
const ICON_NAME = "SelectIcon";
|
|
146
|
+
const SelectIcon = React.forwardRef((props, forwardedRef) => {
|
|
147
|
+
const { __scopeSelect, children, ...iconProps } = props;
|
|
148
|
+
return /* @__PURE__ */ React.createElement(XStack, {
|
|
149
|
+
"aria-hidden": true,
|
|
150
|
+
...iconProps,
|
|
151
|
+
ref: forwardedRef
|
|
152
|
+
}, children || "\u25BC");
|
|
153
|
+
});
|
|
154
|
+
SelectIcon.displayName = ICON_NAME;
|
|
155
|
+
const CONTENT_NAME = "SelectContent";
|
|
156
|
+
const SelectContent = React.forwardRef((props, forwardedRef) => {
|
|
157
|
+
const context = useSelectContext(CONTENT_NAME, props.__scopeSelect);
|
|
158
|
+
return props.children;
|
|
159
|
+
});
|
|
160
|
+
const GROUP_NAME = "SelectGroup";
|
|
161
|
+
const [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME);
|
|
162
|
+
const SelectGroup = React.forwardRef((props, forwardedRef) => {
|
|
163
|
+
const { __scopeSelect, ...groupProps } = props;
|
|
164
|
+
const groupId = useId();
|
|
165
|
+
return /* @__PURE__ */ React.createElement(SelectGroupContextProvider, {
|
|
166
|
+
scope: __scopeSelect,
|
|
167
|
+
id: groupId
|
|
168
|
+
}, /* @__PURE__ */ React.createElement(Primitive.div, {
|
|
169
|
+
role: "group",
|
|
170
|
+
"aria-labelledby": groupId,
|
|
171
|
+
...groupProps,
|
|
172
|
+
ref: forwardedRef
|
|
173
|
+
}));
|
|
174
|
+
});
|
|
175
|
+
SelectGroup.displayName = GROUP_NAME;
|
|
176
|
+
const LABEL_NAME = "SelectLabel";
|
|
177
|
+
const SelectLabel = React.forwardRef((props, forwardedRef) => {
|
|
178
|
+
const { __scopeSelect, ...labelProps } = props;
|
|
179
|
+
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
180
|
+
return /* @__PURE__ */ React.createElement(Primitive.div, {
|
|
181
|
+
id: groupContext.id,
|
|
182
|
+
...labelProps,
|
|
183
|
+
ref: forwardedRef
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
SelectLabel.displayName = LABEL_NAME;
|
|
187
|
+
const ITEM_NAME = "SelectItem";
|
|
188
|
+
const [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);
|
|
189
|
+
const SelectItem = React.forwardRef((props, forwardedRef) => {
|
|
190
|
+
const { __scopeSelect, value, disabled = false, textValue: textValueProp, ...itemProps } = props;
|
|
191
|
+
const context = useSelectContext(ITEM_NAME, __scopeSelect);
|
|
192
|
+
const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect);
|
|
193
|
+
const isSelected = context.value === value;
|
|
194
|
+
const [textValue, setTextValue] = React.useState(textValueProp != null ? textValueProp : "");
|
|
195
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
196
|
+
const composedRefs = useComposedRefs(forwardedRef, isSelected ? contentContext.onSelectedItemChange : void 0);
|
|
197
|
+
const textId = useId();
|
|
198
|
+
const handleSelect = /* @__PURE__ */ __name(() => {
|
|
199
|
+
if (!disabled) {
|
|
200
|
+
context.onValueChange(value);
|
|
201
|
+
context.onOpenChange(false);
|
|
202
|
+
}
|
|
203
|
+
}, "handleSelect");
|
|
204
|
+
return /* @__PURE__ */ React.createElement(SelectItemContextProvider, {
|
|
205
|
+
scope: __scopeSelect,
|
|
206
|
+
value,
|
|
207
|
+
textId,
|
|
208
|
+
isSelected,
|
|
209
|
+
onItemTextChange: React.useCallback((node) => {
|
|
210
|
+
setTextValue((prevTextValue) => {
|
|
211
|
+
var _a;
|
|
212
|
+
return prevTextValue || ((_a = node == null ? void 0 : node.textContent) != null ? _a : "").trim();
|
|
213
|
+
});
|
|
214
|
+
}, [])
|
|
215
|
+
}, /* @__PURE__ */ React.createElement(Collection.ItemSlot, {
|
|
216
|
+
scope: __scopeSelect,
|
|
217
|
+
value,
|
|
218
|
+
disabled,
|
|
219
|
+
textValue
|
|
220
|
+
}, /* @__PURE__ */ React.createElement(Primitive.div, {
|
|
221
|
+
role: "option",
|
|
222
|
+
"aria-labelledby": textId,
|
|
223
|
+
"aria-selected": isSelected && isFocused,
|
|
224
|
+
"data-state": isSelected ? "active" : "inactive",
|
|
225
|
+
"aria-disabled": disabled || void 0,
|
|
226
|
+
"data-disabled": disabled ? "" : void 0,
|
|
227
|
+
tabIndex: disabled ? void 0 : -1,
|
|
228
|
+
...itemProps,
|
|
229
|
+
ref: composedRefs,
|
|
230
|
+
onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
231
|
+
onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
232
|
+
onPointerUp: composeEventHandlers(itemProps.onPointerUp, handleSelect),
|
|
233
|
+
onPointerMove: composeEventHandlers(itemProps.onPointerMove, (event) => {
|
|
234
|
+
if (disabled) {
|
|
235
|
+
contentContext.onItemLeave();
|
|
236
|
+
} else {
|
|
237
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
238
|
+
}
|
|
239
|
+
}),
|
|
240
|
+
onPointerLeave: composeEventHandlers(itemProps.onPointerLeave, (event) => {
|
|
241
|
+
if (event.currentTarget === document.activeElement) {
|
|
242
|
+
contentContext.onItemLeave();
|
|
243
|
+
}
|
|
244
|
+
}),
|
|
245
|
+
onKeyDown: composeEventHandlers(itemProps.onKeyDown, (event) => {
|
|
246
|
+
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
247
|
+
if (isTypingAhead && event.key === " ")
|
|
248
|
+
return;
|
|
249
|
+
if (SELECTION_KEYS.includes(event.key))
|
|
250
|
+
handleSelect();
|
|
251
|
+
if (event.key === " ")
|
|
252
|
+
event.preventDefault();
|
|
253
|
+
})
|
|
254
|
+
})));
|
|
255
|
+
});
|
|
256
|
+
SelectItem.displayName = ITEM_NAME;
|
|
257
|
+
const ITEM_TEXT_NAME = "SelectItemText";
|
|
258
|
+
const SelectItemText = React.forwardRef((props, forwardedRef) => {
|
|
259
|
+
var _a;
|
|
260
|
+
const { __scopeSelect, className, style, ...itemTextProps } = props;
|
|
261
|
+
const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
262
|
+
const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
263
|
+
const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
264
|
+
const ref = React.useRef(null);
|
|
265
|
+
const composedRefs = useComposedRefs(forwardedRef, ref, itemContext.onItemTextChange, itemContext.isSelected ? contentContext.onSelectedItemTextChange : void 0);
|
|
266
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Primitive.span, {
|
|
267
|
+
id: itemContext.textId,
|
|
268
|
+
...itemTextProps,
|
|
269
|
+
ref: composedRefs
|
|
270
|
+
}), itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null, context.bubbleSelect ? ReactDOM.createPortal(/* @__PURE__ */ React.createElement("option", {
|
|
271
|
+
value: itemContext.value
|
|
272
|
+
}, (_a = ref.current) == null ? void 0 : _a.textContent), context.bubbleSelect) : null);
|
|
273
|
+
});
|
|
274
|
+
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
275
|
+
const ITEM_INDICATOR_NAME = "SelectItemIndicator";
|
|
276
|
+
const SelectItemIndicator = React.forwardRef((props, forwardedRef) => {
|
|
277
|
+
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
278
|
+
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
279
|
+
return itemContext.isSelected ? /* @__PURE__ */ React.createElement(Primitive.span, {
|
|
280
|
+
"aria-hidden": true,
|
|
281
|
+
...itemIndicatorProps,
|
|
282
|
+
ref: forwardedRef
|
|
283
|
+
}) : null;
|
|
284
|
+
});
|
|
285
|
+
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
286
|
+
const SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton";
|
|
287
|
+
const SelectScrollUpButton = React.forwardRef((props, forwardedRef) => {
|
|
288
|
+
const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
289
|
+
const [canScrollUp, setCanScrollUp] = React.useState(false);
|
|
290
|
+
const composedRefs = useComposedRefs(forwardedRef, contentContext.onScrollButtonChange);
|
|
291
|
+
return canScrollUp ? /* @__PURE__ */ React.createElement(SelectScrollButtonImpl, {
|
|
292
|
+
...props,
|
|
293
|
+
ref: composedRefs,
|
|
294
|
+
onAutoScroll: () => {
|
|
295
|
+
const { viewport, selectedItem } = contentContext;
|
|
296
|
+
if (viewport && selectedItem) {
|
|
297
|
+
viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}) : null;
|
|
301
|
+
});
|
|
302
|
+
SelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;
|
|
303
|
+
const SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton";
|
|
304
|
+
const SelectScrollDownButton = React.forwardRef((props, forwardedRef) => {
|
|
305
|
+
const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
306
|
+
const [canScrollDown, setCanScrollDown] = React.useState(false);
|
|
307
|
+
const composedRefs = useComposedRefs(forwardedRef, contentContext.onScrollButtonChange);
|
|
308
|
+
return canScrollDown ? /* @__PURE__ */ React.createElement(SelectScrollButtonImpl, {
|
|
309
|
+
...props,
|
|
310
|
+
ref: composedRefs,
|
|
311
|
+
onAutoScroll: () => {
|
|
312
|
+
const { viewport, selectedItem } = contentContext;
|
|
313
|
+
if (viewport && selectedItem) {
|
|
314
|
+
viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}) : null;
|
|
318
|
+
});
|
|
319
|
+
SelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
320
|
+
const SelectScrollButtonImpl = React.forwardRef((props, forwardedRef) => {
|
|
321
|
+
const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;
|
|
322
|
+
const contentContext = useSelectContentContext("SelectScrollButton", __scopeSelect);
|
|
323
|
+
const autoScrollTimerRef = React.useRef(null);
|
|
324
|
+
const intervalRef = React.useRef();
|
|
325
|
+
const loopingRef = React.useRef(false);
|
|
326
|
+
const { x, y, reference, floating, strategy, update, refs } = useFloating({
|
|
327
|
+
strategy: "fixed",
|
|
328
|
+
placement: dir === "up" ? "top" : "bottom",
|
|
329
|
+
middleware: [offset(({ floating: floating2 }) => -floating2.height)]
|
|
330
|
+
});
|
|
331
|
+
return /* @__PURE__ */ React.createElement(Primitive.div, {
|
|
332
|
+
"aria-hidden": true,
|
|
333
|
+
...scrollIndicatorProps,
|
|
334
|
+
ref: forwardedRef,
|
|
335
|
+
style: { flexShrink: 0, ...scrollIndicatorProps.style },
|
|
336
|
+
onPointerMove: composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {
|
|
337
|
+
contentContext.onItemLeave();
|
|
338
|
+
if (autoScrollTimerRef.current === null) {
|
|
339
|
+
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
340
|
+
}
|
|
341
|
+
}),
|
|
342
|
+
onPointerLeave: composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {
|
|
343
|
+
clearAutoScrollTimer();
|
|
344
|
+
})
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
const SEPARATOR_NAME = "SelectSeparator";
|
|
348
|
+
const SelectSeparator = Separator;
|
|
349
|
+
SelectSeparator.displayName = SEPARATOR_NAME;
|
|
350
|
+
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
351
|
+
const { value, ...selectProps } = props;
|
|
352
|
+
const ref = React.useRef(null);
|
|
353
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
354
|
+
const prevValue = usePrevious(value);
|
|
355
|
+
React.useEffect(() => {
|
|
356
|
+
const select = ref.current;
|
|
357
|
+
const selectProto = window.HTMLSelectElement.prototype;
|
|
358
|
+
const descriptor = Object.getOwnPropertyDescriptor(selectProto, "value");
|
|
359
|
+
const setValue = descriptor.set;
|
|
360
|
+
if (prevValue !== value && setValue) {
|
|
361
|
+
const event = new Event("change", { bubbles: true });
|
|
362
|
+
setValue.call(select, value);
|
|
363
|
+
select.dispatchEvent(event);
|
|
364
|
+
}
|
|
365
|
+
}, [prevValue, value]);
|
|
366
|
+
return null;
|
|
367
|
+
return /* @__PURE__ */ React.createElement(VisuallyHidden, {
|
|
368
|
+
asChild: true
|
|
369
|
+
}, /* @__PURE__ */ React.createElement("select", {
|
|
370
|
+
...selectProps,
|
|
371
|
+
ref: composedRefs,
|
|
372
|
+
defaultValue: value
|
|
373
|
+
}));
|
|
374
|
+
});
|
|
375
|
+
export {
|
|
376
|
+
Select,
|
|
377
|
+
SelectContent,
|
|
378
|
+
SelectGroup,
|
|
379
|
+
SelectIcon,
|
|
380
|
+
SelectItem,
|
|
381
|
+
SelectItemIndicator,
|
|
382
|
+
SelectItemText,
|
|
383
|
+
SelectLabel,
|
|
384
|
+
SelectScrollDownButton,
|
|
385
|
+
SelectScrollUpButton,
|
|
386
|
+
SelectSeparator,
|
|
387
|
+
SelectTrigger,
|
|
388
|
+
SelectValue,
|
|
389
|
+
createSelectScope
|
|
390
|
+
};
|
|
391
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Select.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n ContextData,\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n autoUpdate,\n detectOverflow,\n flip,\n offset,\n size,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useListNavigation,\n useRole,\n useTypeahead,\n} from '@floating-ui/react-dom-interactions'\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref'\nimport { usePrevious } from '@radix-ui/react-use-previous'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { composeEventHandlers, useIsomorphicLayoutEffect } from '@tamagui/core'\n// import { useDirection } from '@tamagui/react-direction'\n// import { DismissableLayer } from '@tamagui/react-dismissable-layer'\n// import { FocusScope } from '@tamagui/react-focus-scope'\nimport { useId } from '@tamagui/core'\nimport { createContextScope } from '@tamagui/create-context'\nimport type { Scope } from '@tamagui/create-context'\nimport { clamp } from '@tamagui/helpers'\n// import { useLabelContext } from '@tamagui/react-label'\nimport { Portal } from '@tamagui/portal'\nimport { Separator } from '@tamagui/separator'\nimport { XStack, YStack, YStackProps } from '@tamagui/stacks'\n// import { Primitive } from '@tamagui/react-primitive'\n// import type * as Radix from '@tamagui/react-primitive'\nimport { useControllableState } from '@tamagui/use-controllable-state'\n// import { useLayoutEffect } from '@tamagui/react-use-layout-effect'\n// import { usePrevious } from '@tamagui/react-use-previous'\n// import { VisuallyHidden } from '@tamagui/core'\n// import { hideOthers } from 'aria-hidden'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\nimport { View } from 'react-native'\n\n// import { RemoveScroll } from 'react-remove-scroll'\n\n// upsides:\n// could virtualize in the future\n// should be a decent amount faster\n// no having to set keys\n// no internal awkward traversal of children, impossible on native\n\n// downsides:\n// have to have a hook with a new type of pattern\n\n// alternate is just to require passing index={}\n\n// const select = useSelect()\n//\n// <Select items={[]}>\n// <SelectTrigger>\n// <SelectIcon />\n// <SelectValue />\n// </SelectTrigger>\n//\n// <SelectContent>\n// <SelectScrollUpButton />\n// <SelectScrollDownButton />\n//\n// can optionally include group\n// <SelectItemGroup>\n// <SelectItemGroupLabel />\n// </SelectItemGroup>\n//\n// <SelectItem>\n// <SelectItemText>\n// {select.text}\n// </SelectItemText>\n// <SelectItemIndicator />\n// </SelectItem>\n// </SelectItemGroup>\n//\n// </SelectContent>\n// </Select>\n\ntype GenericElement = HTMLElement | View\n\ntype Direction = 'ltr' | 'rtl'\n\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown']\nconst SELECTION_KEYS = [' ', 'Enter']\n\n/* -------------------------------------------------------------------------------------------------\n * Select\n * -----------------------------------------------------------------------------------------------*/\n\nconst SELECT_NAME = 'Select'\n\nconst WINDOW_PADDING = 8\nconst SCROLL_ARROW_VELOCITY = 8\nconst SCROLL_ARROW_THRESHOLD = 8\nconst MIN_HEIGHT = 80\nconst FALLBACK_THRESHOLD = 16\n\ninterface SelectContextValue {\n selectedIndex: number\n setSelectedIndex: (index: number) => void\n activeIndex: number | null\n setActiveIndex: (index: number | null) => void\n listRef: React.MutableRefObject<Array<HTMLLIElement | null>>\n open: boolean\n setOpen: (open: boolean) => void\n onChange: (value: string) => void\n dataRef: React.MutableRefObject<ContextData>\n getItemProps: (userProps?: React.HTMLProps<HTMLElement>) => any\n controlledScrolling: boolean\n canScrollUp: boolean\n canScrollDown: boolean\n}\n\n// type SelectContentContextValue = {\n// contentWrapper: HTMLDivElement | null\n// content: SelectContentElement | null\n// viewport: SelectViewportElement | null\n// onViewportChange(node: SelectViewportElement | null): void\n// selectedItem: SelectItemElement | null\n// onSelectedItemChange(node: SelectItemElement | null): void\n// selectedItemText: SelectItemTextElement | null\n// onSelectedItemTextChange(node: SelectItemTextElement | null): void\n// onScrollButtonChange(node: SelectScrollButtonImplElement | null): void\n// onItemLeave(): void\n// isPositioned: boolean\n// shouldExpandOnScrollRef: React.RefObject<boolean>\n// searchRef: React.RefObject<string>\n// }\n\n// const [SelectContentContextProvider, useSelectContentContext] =\n// createSelectContext<SelectContentContextValue>(CONTENT_NAME)\n\n// const SelectContext = React.createContext({} as SelectContextValue)\n\ntype ScopedProps<P> = P & { __scopeSelect?: Scope }\n\nconst [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME)\nconst [SelectProvider, useSelectContext] = createSelectContext<SelectContextValue>(SELECT_NAME)\n\ninterface SelectProps {\n children?: React.ReactNode\n value?: string\n defaultValue?: string\n onValueChange?(value: string): void\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?(open: boolean): void\n dir?: Direction\n name?: string\n autoComplete?: string\n}\n\nconst Select: React.FC<SelectProps> = (props: ScopedProps<SelectProps>) => {\n const {\n __scopeSelect,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n dir,\n name,\n autoComplete,\n } = props\n // const [trigger, setTrigger] = React.useState<SelectTriggerElement | null>(null)\n // const [valueNode, setValueNode] = React.useState<SelectValueElement | null>(null)\n // const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false)\n // const direction = useDirection(dir)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n })\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue || '',\n onChange: onValueChange,\n })\n\n // const listContentRef = useRef([\n // \"Select...\",\n // ...(Children.map(children, (child) =>\n // Children.map(\n // isValidElement(child) && child.props.children,\n // (child) => child.props.value\n // )\n // ) ?? [])\n // ]);\n\n const selectedIndexRef = React.useRef<number | null>(null)\n const activeIndexRef = React.useRef<number | null>(null)\n const prevActiveIndex = usePrevious<number | null>(activeIndex)\n\n const [showArrows, setShowArrows] = React.useState(false)\n const [scrollTop, setScrollTop] = React.useState(0)\n const [activeIndex, setActiveIndex] = React.useState<number | null>(null)\n const [selectedIndex, setSelectedIndex] = React.useState(\n Math.max(0, listContentRef.current.indexOf(value))\n )\n\n useIsomorphicLayoutEffect(() => {\n selectedIndexRef.current = selectedIndex\n activeIndexRef.current = activeIndex\n })\n\n // Wait for scroll position to settle before showing arrows to prevent\n // interference with pointer events.\n useEffect(() => {\n const frame = requestAnimationFrame(() => {\n setShowArrows(open)\n\n if (!open) {\n setScrollTop(0)\n setMiddlewareType('align')\n setActiveIndex(null)\n setControlledScrolling(false)\n }\n })\n return () => cancelAnimationFrame(frame)\n }, [open])\n\n const showUpArrow = showArrows && scrollTop > SCROLL_ARROW_THRESHOLD\n const showDownArrow =\n showArrows &&\n floatingRef.current &&\n scrollTop <\n floatingRef.current.scrollHeight - floatingRef.current.clientHeight - SCROLL_ARROW_THRESHOLD\n\n // We set this to true by default so that events bubble to forms without JS (SSR)\n // const isFormControl = trigger ? Boolean(trigger.closest('form')) : true\n // const [bubbleSelect, setBubbleSelect] = React.useState<HTMLSelectElement | null>(null)\n // const triggerPointerDownPosRef = React.useRef<{ x: number; y: number } | null>(null)\n\n return (\n <SelectProvider\n scope={__scopeSelect}\n // trigger={trigger}\n // onTriggerChange={setTrigger}\n // valueNode={valueNode}\n // onValueNodeChange={setValueNode}\n // valueNodeHasChildren={valueNodeHasChildren}\n // onValueNodeHasChildrenChange={setValueNodeHasChildren}\n // contentId={useId() || ''}\n // value={value}\n // onValueChange={setValue}\n open={open}\n // onOpenChange={setOpen}\n // TODO\n // dir={'rtl'} //direction}\n // bubbleSelect={bubbleSelect}\n // triggerPointerDownPosRef={triggerPointerDownPosRef}\n >\n {/* <Collection.Provider scope={__scopeSelect}>{children}</Collection.Provider> */}\n {children}\n {/* {isFormControl ? (\n <BubbleSelect\n ref={setBubbleSelect}\n aria-hidden\n tabIndex={-1}\n name={name}\n autoComplete={autoComplete}\n value={value}\n // enable form autofill\n onChange={(event) => setValue(event.target.value)}\n />\n ) : null} */}\n </SelectProvider>\n )\n}\n\nSelect.displayName = SELECT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'SelectTrigger'\n\ntype SelectTriggerElement = GenericElement\ntype SelectTriggerProps = YStackProps\n\nconst SelectTrigger = React.forwardRef<SelectTriggerElement, SelectTriggerProps>(\n (props: ScopedProps<SelectTriggerProps>, forwardedRef) => {\n const {\n __scopeSelect,\n disabled = false,\n // @ts-ignore\n 'aria-labelledby': ariaLabelledby,\n ...triggerProps\n } = props\n const context = useSelectContext(TRIGGER_NAME, __scopeSelect)\n const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange)\n const getItems = useCollection(__scopeSelect)\n // const labelId = useLabelContext(context.trigger)\n // const labelledBy = ariaLabelledby || labelId\n\n // const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {\n // const enabledItems = getItems().filter((item) => !item.disabled)\n // const currentItem = enabledItems.find((item) => item.value === context.value)\n // const nextItem = findNextItem(enabledItems, search, currentItem)\n // if (nextItem !== undefined) {\n // context.onValueChange(nextItem.value)\n // }\n // })\n\n const handleOpen = () => {\n if (!disabled) {\n context.onOpenChange(true)\n // reset typeahead when we open\n resetTypeahead()\n }\n }\n\n return (\n <Primitive.button\n type=\"button\"\n role=\"combobox\"\n aria-controls={context.contentId}\n aria-expanded={context.open}\n aria-autocomplete=\"none\"\n // aria-labelledby={labelledBy}\n dir={context.dir}\n disabled={disabled}\n data-disabled={disabled ? '' : undefined}\n {...triggerProps}\n ref={composedRefs}\n onPointerDown={composeEventHandlers(triggerProps.onPointerDown, (event) => {\n // prevent implicit pointer capture\n // https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture\n ;(event.target as HTMLElement).releasePointerCapture(event.pointerId)\n\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (event.button === 0 && event.ctrlKey === false) {\n handleOpen()\n context.triggerPointerDownPosRef.current = {\n x: Math.round(event.pageX),\n y: Math.round(event.pageY),\n }\n // prevent trigger from stealing focus from the active item after opening.\n event.preventDefault()\n }\n })}\n onKeyDown={composeEventHandlers(triggerProps.onKeyDown, (event) => {\n const isTypingAhead = searchRef.current !== ''\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey\n if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key)\n if (isTypingAhead && event.key === ' ') return\n if (OPEN_KEYS.includes(event.key)) {\n handleOpen()\n event.preventDefault()\n }\n })}\n />\n )\n }\n)\n\nSelectTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectValue\n * -----------------------------------------------------------------------------------------------*/\n\nconst VALUE_NAME = 'SelectValue'\n\ntype SelectValueElement = GenericElement\ntype SelectValueProps = YStackProps\n\nconst SelectValue = React.forwardRef<SelectValueElement, SelectValueProps>(\n (props: ScopedProps<SelectValueProps>, forwardedRef) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const { __scopeSelect, className, style, ...valueProps } = props\n // const context = useSelectContext(VALUE_NAME, __scopeSelect)\n // const { onValueNodeHasChildrenChange } = context\n // const hasChildren = props.children !== undefined\n // const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange)\n\n // React.useEffect(() => {\n // onValueNodeHasChildrenChange(hasChildren)\n // }, [onValueNodeHasChildrenChange, hasChildren])\n\n return (\n <XStack\n {...valueProps}\n // ref={composedRefs}\n // we don't want events from the portalled `SelectValue` children to bubble\n // through the item they came from\n pointerEvents=\"none\"\n />\n )\n }\n)\n\n// SelectValue.displayName = VALUE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectIcon\n * -----------------------------------------------------------------------------------------------*/\n\nconst ICON_NAME = 'SelectIcon'\n\ntype SelectIconProps = YStackProps\ntype SelectIconElement = GenericElement\n\nconst SelectIcon = React.forwardRef<SelectIconElement, SelectIconProps>(\n (props: ScopedProps<SelectIconProps>, forwardedRef) => {\n const { __scopeSelect, children, ...iconProps } = props\n return (\n <XStack aria-hidden {...iconProps} ref={forwardedRef}>\n {children || '\u25BC'}\n </XStack>\n )\n }\n)\n\nSelectIcon.displayName = ICON_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent'\n\ntype SelectContentElement = any\ntype SelectContentProps = any\n\nconst SelectContent = React.forwardRef<SelectContentElement, SelectContentProps>(\n (props: ScopedProps<SelectContentProps>, forwardedRef) => {\n const context = useSelectContext(CONTENT_NAME, props.__scopeSelect)\n return props.children\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * SelectGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'SelectGroup'\n\ntype SelectGroupContextValue = { id: string }\n\nconst [SelectGroupContextProvider, useSelectGroupContext] =\n createSelectContext<SelectGroupContextValue>(GROUP_NAME)\n\ntype SelectGroupElement = React.ElementRef<typeof Primitive.div>\ninterface SelectGroupProps extends PrimitiveDivProps {}\n\nconst SelectGroup = React.forwardRef<SelectGroupElement, SelectGroupProps>(\n (props: ScopedProps<SelectGroupProps>, forwardedRef) => {\n const { __scopeSelect, ...groupProps } = props\n const groupId = useId()\n return (\n <SelectGroupContextProvider scope={__scopeSelect} id={groupId}>\n <Primitive.div role=\"group\" aria-labelledby={groupId} {...groupProps} ref={forwardedRef} />\n </SelectGroupContextProvider>\n )\n }\n)\n\nSelectGroup.displayName = GROUP_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'SelectLabel'\n\ntype SelectLabelElement = React.ElementRef<typeof Primitive.div>\ninterface SelectLabelProps extends PrimitiveDivProps {}\n\nconst SelectLabel = React.forwardRef<SelectLabelElement, SelectLabelProps>(\n (props: ScopedProps<SelectLabelProps>, forwardedRef) => {\n const { __scopeSelect, ...labelProps } = props\n const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect)\n return <Primitive.div id={groupContext.id} {...labelProps} ref={forwardedRef} />\n }\n)\n\nSelectLabel.displayName = LABEL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'SelectItem'\n\ntype SelectItemContextValue = {\n value: string\n textId: string\n isSelected: boolean\n onItemTextChange(node: SelectItemTextElement | null): void\n}\n\nconst [SelectItemContextProvider, useSelectItemContext] =\n createSelectContext<SelectItemContextValue>(ITEM_NAME)\n\ntype SelectItemElement = React.ElementRef<typeof Primitive.div>\ninterface SelectItemProps extends PrimitiveDivProps {\n value: string\n disabled?: boolean\n textValue?: string\n}\n\nconst SelectItem = React.forwardRef<SelectItemElement, SelectItemProps>(\n (props: ScopedProps<SelectItemProps>, forwardedRef) => {\n const { __scopeSelect, value, disabled = false, textValue: textValueProp, ...itemProps } = props\n const context = useSelectContext(ITEM_NAME, __scopeSelect)\n const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect)\n const isSelected = context.value === value\n const [textValue, setTextValue] = React.useState(textValueProp ?? '')\n const [isFocused, setIsFocused] = React.useState(false)\n const composedRefs = useComposedRefs(\n forwardedRef,\n isSelected ? contentContext.onSelectedItemChange : undefined\n )\n const textId = useId()\n\n const handleSelect = () => {\n if (!disabled) {\n context.onValueChange(value)\n context.onOpenChange(false)\n }\n }\n\n return (\n <SelectItemContextProvider\n scope={__scopeSelect}\n value={value}\n textId={textId}\n isSelected={isSelected}\n onItemTextChange={React.useCallback((node) => {\n setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? '').trim())\n }, [])}\n >\n <Collection.ItemSlot\n scope={__scopeSelect}\n value={value}\n disabled={disabled}\n textValue={textValue}\n >\n <Primitive.div\n role=\"option\"\n aria-labelledby={textId}\n // `isFocused` caveat fixes stuttering in VoiceOver\n aria-selected={isSelected && isFocused}\n data-state={isSelected ? 'active' : 'inactive'}\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n tabIndex={disabled ? undefined : -1}\n {...itemProps}\n ref={composedRefs}\n onFocus={composeEventHandlers(itemProps.onFocus, () => setIsFocused(true))}\n onBlur={composeEventHandlers(itemProps.onBlur, () => setIsFocused(false))}\n onPointerUp={composeEventHandlers(itemProps.onPointerUp, handleSelect)}\n onPointerMove={composeEventHandlers(itemProps.onPointerMove, (event) => {\n if (disabled) {\n contentContext.onItemLeave()\n } else {\n // even though safari doesn't support this option, it's acceptable\n // as it only means it might scroll a few pixels when using the pointer.\n event.currentTarget.focus({ preventScroll: true })\n }\n })}\n onPointerLeave={composeEventHandlers(itemProps.onPointerLeave, (event) => {\n if (event.currentTarget === document.activeElement) {\n contentContext.onItemLeave()\n }\n })}\n onKeyDown={composeEventHandlers(itemProps.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== ''\n if (isTypingAhead && event.key === ' ') return\n if (SELECTION_KEYS.includes(event.key)) handleSelect()\n // prevent page scroll if using the space key to select an item\n if (event.key === ' ') event.preventDefault()\n })}\n />\n </Collection.ItemSlot>\n </SelectItemContextProvider>\n )\n }\n)\n\nSelectItem.displayName = ITEM_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'SelectItemText'\n\ntype SelectItemTextElement = React.ElementRef<typeof Primitive.span>\ninterface SelectItemTextProps extends PrimitiveSpanProps {}\n\nconst SelectItemText = React.forwardRef<SelectItemTextElement, SelectItemTextProps>(\n (props: ScopedProps<SelectItemTextProps>, forwardedRef) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const { __scopeSelect, className, style, ...itemTextProps } = props\n const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect)\n const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect)\n const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect)\n const ref = React.useRef<SelectItemTextElement | null>(null)\n const composedRefs = useComposedRefs(\n forwardedRef,\n ref,\n itemContext.onItemTextChange,\n itemContext.isSelected ? contentContext.onSelectedItemTextChange : undefined\n )\n\n return (\n <>\n <Primitive.span id={itemContext.textId} {...itemTextProps} ref={composedRefs} />\n\n {/* Portal the select item text into the trigger value node */}\n {itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren\n ? ReactDOM.createPortal(itemTextProps.children, context.valueNode)\n : null}\n\n {/* Portal an option in the bubble select */}\n {context.bubbleSelect\n ? ReactDOM.createPortal(\n // we use `.textContent` because `option` only support `string` or `number`\n <option value={itemContext.value}>{ref.current?.textContent}</option>,\n context.bubbleSelect\n )\n : null}\n </>\n )\n }\n)\n\nSelectItemText.displayName = ITEM_TEXT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'SelectItemIndicator'\n\ntype SelectItemIndicatorElement = React.ElementRef<typeof Primitive.span>\ninterface SelectItemIndicatorProps extends PrimitiveSpanProps {}\n\nconst SelectItemIndicator = React.forwardRef<SelectItemIndicatorElement, SelectItemIndicatorProps>(\n (props: ScopedProps<SelectItemIndicatorProps>, forwardedRef) => {\n const { __scopeSelect, ...itemIndicatorProps } = props\n const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect)\n return itemContext.isSelected ? (\n <Primitive.span aria-hidden {...itemIndicatorProps} ref={forwardedRef} />\n ) : null\n }\n)\n\nSelectItemIndicator.displayName = ITEM_INDICATOR_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollUpButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton'\n\ntype SelectScrollUpButtonElement = SelectScrollButtonImplElement\ninterface SelectScrollUpButtonProps extends Omit<SelectScrollButtonImplProps, 'onAutoScroll'> {}\n\nconst SelectScrollUpButton = React.forwardRef<\n SelectScrollUpButtonElement,\n SelectScrollUpButtonProps\n>((props: ScopedProps<SelectScrollUpButtonProps>, forwardedRef) => {\n const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect)\n const [canScrollUp, setCanScrollUp] = React.useState(false)\n const composedRefs = useComposedRefs(forwardedRef, contentContext.onScrollButtonChange)\n\n // useLayoutEffect(() => {\n // if (contentContext.viewport && contentContext.isPositioned) {\n // const viewport = contentContext.viewport\n // function handleScroll() {\n // const canScrollUp = viewport.scrollTop > 0\n // setCanScrollUp(canScrollUp)\n // }\n // handleScroll()\n // viewport.addEventListener('scroll', handleScroll)\n // return () => viewport.removeEventListener('scroll', handleScroll)\n // }\n // }, [contentContext.viewport, contentContext.isPositioned])\n\n return canScrollUp ? (\n <SelectScrollButtonImpl\n {...props}\n ref={composedRefs}\n onAutoScroll={() => {\n const { viewport, selectedItem } = contentContext\n if (viewport && selectedItem) {\n viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight\n }\n }}\n />\n ) : null\n})\n\nSelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollDownButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton'\n\ntype SelectScrollDownButtonElement = SelectScrollButtonImplElement\ninterface SelectScrollDownButtonProps extends Omit<SelectScrollButtonImplProps, 'onAutoScroll'> {}\n\nconst SelectScrollDownButton = React.forwardRef<\n SelectScrollDownButtonElement,\n SelectScrollDownButtonProps\n>((props: ScopedProps<SelectScrollDownButtonProps>, forwardedRef) => {\n const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect)\n const [canScrollDown, setCanScrollDown] = React.useState(false)\n const composedRefs = useComposedRefs(forwardedRef, contentContext.onScrollButtonChange)\n\n // useLayoutEffect(() => {\n // if (contentContext.viewport && contentContext.isPositioned) {\n // const viewport = contentContext.viewport\n // function handleScroll() {\n // const maxScroll = viewport.scrollHeight - viewport.clientHeight\n // // we use Math.ceil here because if the UI is zoomed-in\n // // `scrollTop` is not always reported as an integer\n // const canScrollDown = Math.ceil(viewport.scrollTop) < maxScroll\n // setCanScrollDown(canScrollDown)\n // }\n // handleScroll()\n // viewport.addEventListener('scroll', handleScroll)\n // return () => viewport.removeEventListener('scroll', handleScroll)\n // }\n // }, [contentContext.viewport, contentContext.isPositioned])\n\n return canScrollDown ? (\n <SelectScrollButtonImpl\n {...props}\n ref={composedRefs}\n onAutoScroll={() => {\n const { viewport, selectedItem } = contentContext\n if (viewport && selectedItem) {\n viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight\n }\n }}\n />\n ) : null\n})\n\nSelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME\n\ntype SelectScrollButtonImplElement = React.ElementRef<typeof Primitive.div>\ninterface SelectScrollButtonImplProps extends PrimitiveDivProps {\n onAutoScroll(): void\n}\n\nconst SelectScrollButtonImpl = React.forwardRef<\n SelectScrollButtonImplElement,\n SelectScrollButtonImplProps\n>((props: ScopedProps<SelectScrollButtonImplProps>, forwardedRef) => {\n const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props\n const contentContext = useSelectContentContext('SelectScrollButton', __scopeSelect)\n const autoScrollTimerRef = React.useRef<number | null>(null)\n\n const intervalRef = React.useRef<any>()\n const loopingRef = React.useRef(false)\n\n const { x, y, reference, floating, strategy, update, refs } = useFloating({\n strategy: 'fixed',\n placement: dir === 'up' ? 'top' : 'bottom',\n middleware: [offset(({ floating }) => -floating.height)],\n })\n\n return (\n <Primitive.div\n aria-hidden\n {...scrollIndicatorProps}\n ref={forwardedRef}\n style={{ flexShrink: 0, ...scrollIndicatorProps.style }}\n onPointerMove={composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {\n contentContext.onItemLeave()\n if (autoScrollTimerRef.current === null) {\n autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50)\n }\n })}\n onPointerLeave={composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {\n clearAutoScrollTimer()\n })}\n />\n )\n})\n\n/* -------------------------------------------------------------------------------------------------\n * SelectSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'SelectSeparator'\n\ntype SelectSeparatorElement = React.ElementRef<typeof Primitive.div>\ninterface SelectSeparatorProps extends PrimitiveDivProps {}\n\nconst SelectSeparator = Separator\n// React.forwardRef<SelectSeparatorElement, SelectSeparatorProps>(\n// (props: ScopedProps<SelectSeparatorProps>, forwardedRef) => {\n// const { __scopeSelect, ...separatorProps } = props\n// return <Primitive.div aria-hidden {...separatorProps} ref={forwardedRef} />\n// }\n// )\n\nSelectSeparator.displayName = SEPARATOR_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst BubbleSelect = React.forwardRef<HTMLSelectElement, React.ComponentPropsWithoutRef<'select'>>(\n (props, forwardedRef) => {\n const { value, ...selectProps } = props\n const ref = React.useRef<HTMLSelectElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const prevValue = usePrevious(value)\n\n // Bubble value change to parents (e.g form change event)\n React.useEffect(() => {\n const select = ref.current!\n const selectProto = window.HTMLSelectElement.prototype\n const descriptor = Object.getOwnPropertyDescriptor(selectProto, 'value') as PropertyDescriptor\n const setValue = descriptor.set\n if (prevValue !== value && setValue) {\n const event = new Event('change', { bubbles: true })\n setValue.call(select, value)\n select.dispatchEvent(event)\n }\n }, [prevValue, value])\n\n /**\n * We purposefully use a `select` here to support form autofill as much\n * as possible.\n *\n * We purposefully do not add the `value` attribute here to allow the value\n * to be set programatically and bubble to any parent form `onChange` event.\n * Adding the `value` will cause React to consider the programatic\n * dispatch a duplicate and it will get swallowed.\n *\n * We use `VisuallyHidden` rather than `display: \"none\"` because Safari autofill\n * won't work otherwise.\n */\n // TODO\n return null\n return (\n <VisuallyHidden asChild>\n <select {...selectProps} ref={composedRefs} defaultValue={value} />\n </VisuallyHidden>\n )\n }\n)\n\n// const Root = Select\n// const Trigger = SelectTrigger\n// const Value = SelectValue\n// const Icon = SelectIcon\n// const Content = SelectContent\n// const Viewport = SelectViewport\n// const Group = SelectGroup\n// const Label = SelectLabel\n// const Item = SelectItem\n// const ItemText = SelectItemText\n// const ItemIndicator = SelectItemIndicator\n// const ScrollUpButton = SelectScrollUpButton\n// const ScrollDownButton = SelectScrollDownButton\n// const Separator = SelectSeparator\n\nexport {\n createSelectScope,\n //\n Select,\n SelectTrigger,\n SelectValue,\n SelectIcon,\n SelectContent,\n // SelectViewport,\n SelectGroup,\n SelectLabel,\n SelectItem,\n SelectItemText,\n SelectItemIndicator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n SelectSeparator,\n //\n // Root,\n // Trigger,\n // Value,\n // Icon,\n // Content,\n // Viewport,\n // Group,\n // Label,\n // Item,\n // ItemText,\n // ItemIndicator,\n // ScrollUpButton,\n // ScrollDownButton,\n // Separator,\n}\nexport type {\n SelectProps,\n SelectTriggerProps,\n SelectValueProps,\n SelectIconProps,\n SelectContentProps,\n SelectViewportProps,\n SelectGroupProps,\n SelectLabelProps,\n SelectItemProps,\n SelectItemTextProps,\n SelectItemIndicatorProps,\n SelectScrollUpButtonProps,\n SelectScrollDownButtonProps,\n SelectSeparatorProps,\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA;AAAA;AAAA;AAAA;AAmBA;AACA;AACA;AAIA;AACA;AAKA;AACA;AAGA;AAKA;AACA;AAgDA,MAAM,YAAY,CAAC,KAAK,SAAS,WAAW,WAAW;AACvD,MAAM,iBAAiB,CAAC,KAAK,OAAO;AAMpC,MAAM,cAAc;AAEpB,MAAM,iBAAiB;AACvB,MAAM,wBAAwB;AAC9B,MAAM,yBAAyB;AAC/B,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAyC3B,MAAM,CAAC,qBAAqB,qBAAqB,mBAAmB,WAAW;AAC/E,MAAM,CAAC,gBAAgB,oBAAoB,oBAAwC,WAAW;AAe9F,MAAM,SAAgC,wBAAC,UAAoC;AACzE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAKJ,QAAM,CAAC,MAAM,WAAW,qBAAqB;AAAA,IAC3C,MAAM;AAAA,IACN,aAAa,eAAe;AAAA,IAC5B,UAAU;AAAA,EACZ,CAAC;AACD,QAAM,CAAC,OAAO,YAAY,qBAAqB;AAAA,IAC7C,MAAM;AAAA,IACN,aAAa,gBAAgB;AAAA,IAC7B,UAAU;AAAA,EACZ,CAAC;AAYD,QAAM,mBAAmB,MAAM,OAAsB,IAAI;AACzD,QAAM,iBAAiB,MAAM,OAAsB,IAAI;AACvD,QAAM,kBAAkB,YAA2B,WAAW;AAE9D,QAAM,CAAC,YAAY,iBAAiB,MAAM,SAAS,KAAK;AACxD,QAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,CAAC;AAClD,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAwB,IAAI;AACxE,QAAM,C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