@tamagui/linear-gradient 1.0.11 → 1.0.13
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/package.json +4 -4
- package/dist/cjs/BubbleSelect.js +0 -44
- package/dist/cjs/BubbleSelect.js.map +0 -7
- package/dist/cjs/Select.js +0 -480
- package/dist/cjs/Select.js.map +0 -7
- package/dist/cjs/SelectContent.js +0 -76
- package/dist/cjs/SelectContent.js.map +0 -7
- package/dist/cjs/SelectContent.native.js +0 -31
- package/dist/cjs/SelectContent.native.js.map +0 -7
- package/dist/cjs/SelectImpl.js +0 -301
- package/dist/cjs/SelectImpl.js.map +0 -7
- package/dist/cjs/SelectImpl.native.js +0 -37
- package/dist/cjs/SelectImpl.native.js.map +0 -7
- package/dist/cjs/SelectScrollButton.js +0 -161
- package/dist/cjs/SelectScrollButton.js.map +0 -7
- package/dist/cjs/SelectScrollButton.native.js +0 -32
- package/dist/cjs/SelectScrollButton.native.js.map +0 -7
- package/dist/cjs/SelectViewport.js +0 -126
- package/dist/cjs/SelectViewport.js.map +0 -7
- package/dist/cjs/SelectViewport.native.js +0 -62
- package/dist/cjs/SelectViewport.native.js.map +0 -7
- package/dist/cjs/constants.js +0 -47
- package/dist/cjs/constants.js.map +0 -7
- package/dist/cjs/context.js +0 -49
- package/dist/cjs/context.js.map +0 -7
- package/dist/cjs/types.js +0 -17
- package/dist/cjs/types.js.map +0 -7
- package/dist/cjs/useSelectBreakpointActive.js +0 -39
- package/dist/cjs/useSelectBreakpointActive.js.map +0 -7
- package/dist/esm/BubbleSelect.js +0 -25
- package/dist/esm/BubbleSelect.js.map +0 -7
- package/dist/esm/Select.js +0 -452
- package/dist/esm/Select.js.map +0 -7
- package/dist/esm/SelectContent.js +0 -52
- package/dist/esm/SelectContent.js.map +0 -7
- package/dist/esm/SelectContent.native.js +0 -7
- package/dist/esm/SelectContent.native.js.map +0 -7
- package/dist/esm/SelectImpl.js +0 -286
- package/dist/esm/SelectImpl.js.map +0 -7
- package/dist/esm/SelectImpl.native.js +0 -13
- package/dist/esm/SelectImpl.native.js.map +0 -7
- package/dist/esm/SelectScrollButton.js +0 -130
- package/dist/esm/SelectScrollButton.js.map +0 -7
- package/dist/esm/SelectScrollButton.native.js +0 -7
- package/dist/esm/SelectScrollButton.native.js.map +0 -7
- package/dist/esm/SelectViewport.js +0 -95
- package/dist/esm/SelectViewport.js.map +0 -7
- package/dist/esm/SelectViewport.native.js +0 -32
- package/dist/esm/SelectViewport.native.js.map +0 -7
- package/dist/esm/constants.js +0 -17
- package/dist/esm/constants.js.map +0 -7
- package/dist/esm/context.js +0 -21
- package/dist/esm/context.js.map +0 -7
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -7
- package/dist/esm/useSelectBreakpointActive.js +0 -14
- package/dist/esm/useSelectBreakpointActive.js.map +0 -7
- package/dist/jsx/BubbleSelect.js +0 -25
- package/dist/jsx/BubbleSelect.js.map +0 -7
- package/dist/jsx/Select.js +0 -326
- package/dist/jsx/Select.js.map +0 -7
- package/dist/jsx/SelectContent.js +0 -30
- package/dist/jsx/SelectContent.js.map +0 -7
- package/dist/jsx/SelectContent.native.js +0 -7
- package/dist/jsx/SelectContent.native.js.map +0 -7
- package/dist/jsx/SelectImpl.js +0 -259
- package/dist/jsx/SelectImpl.js.map +0 -7
- package/dist/jsx/SelectImpl.native.js +0 -10
- package/dist/jsx/SelectImpl.native.js.map +0 -7
- package/dist/jsx/SelectScrollButton.js +0 -103
- package/dist/jsx/SelectScrollButton.js.map +0 -7
- package/dist/jsx/SelectScrollButton.native.js +0 -7
- package/dist/jsx/SelectScrollButton.native.js.map +0 -7
- package/dist/jsx/SelectViewport.js +0 -73
- package/dist/jsx/SelectViewport.js.map +0 -7
- package/dist/jsx/SelectViewport.native.js +0 -18
- package/dist/jsx/SelectViewport.native.js.map +0 -7
- package/dist/jsx/constants.js +0 -17
- package/dist/jsx/constants.js.map +0 -7
- package/dist/jsx/context.js +0 -15
- package/dist/jsx/context.js.map +0 -7
- package/dist/jsx/types.js +0 -1
- package/dist/jsx/types.js.map +0 -7
- package/dist/jsx/useSelectBreakpointActive.js +0 -14
- package/dist/jsx/useSelectBreakpointActive.js.map +0 -7
package/dist/esm/SelectImpl.js
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
autoUpdate,
|
|
4
|
-
flip,
|
|
5
|
-
inner,
|
|
6
|
-
offset,
|
|
7
|
-
shift,
|
|
8
|
-
size,
|
|
9
|
-
useClick,
|
|
10
|
-
useDismiss,
|
|
11
|
-
useFloating,
|
|
12
|
-
useInnerOffset,
|
|
13
|
-
useInteractions,
|
|
14
|
-
useListNavigation,
|
|
15
|
-
useRole,
|
|
16
|
-
useTypeahead
|
|
17
|
-
} from "@floating-ui/react-dom-interactions";
|
|
18
|
-
import { isWeb, useIsTouchDevice, useIsomorphicLayoutEffect } from "@tamagui/core";
|
|
19
|
-
import * as React from "react";
|
|
20
|
-
import { flushSync } from "react-dom";
|
|
21
|
-
import { SCROLL_ARROW_THRESHOLD, WINDOW_PADDING } from "./constants";
|
|
22
|
-
import { SelectProvider, useSelectContext } from "./context";
|
|
23
|
-
const SelectInlineImpl = (props) => {
|
|
24
|
-
const {
|
|
25
|
-
__scopeSelect,
|
|
26
|
-
children,
|
|
27
|
-
open = false,
|
|
28
|
-
selectedIndexRef,
|
|
29
|
-
listContentRef
|
|
30
|
-
} = props;
|
|
31
|
-
const selectContext = useSelectContext("SelectSheetImpl", __scopeSelect);
|
|
32
|
-
const {
|
|
33
|
-
setActiveIndex,
|
|
34
|
-
setOpen,
|
|
35
|
-
setSelectedIndex,
|
|
36
|
-
selectedIndex,
|
|
37
|
-
activeIndex,
|
|
38
|
-
forceUpdate
|
|
39
|
-
} = selectContext;
|
|
40
|
-
const [scrollTop, setScrollTop] = React.useState(0);
|
|
41
|
-
const touch = useIsTouchDevice();
|
|
42
|
-
const listItemsRef = React.useRef([]);
|
|
43
|
-
const overflowRef = React.useRef(null);
|
|
44
|
-
const upArrowRef = React.useRef(null);
|
|
45
|
-
const downArrowRef = React.useRef(null);
|
|
46
|
-
const allowSelectRef = React.useRef(false);
|
|
47
|
-
const allowMouseUpRef = React.useRef(true);
|
|
48
|
-
const selectTimeoutRef = React.useRef();
|
|
49
|
-
const state = React.useRef({
|
|
50
|
-
isMouseOutside: false
|
|
51
|
-
});
|
|
52
|
-
const [controlledScrolling, setControlledScrolling] = React.useState(false);
|
|
53
|
-
const [fallback, setFallback] = React.useState(false);
|
|
54
|
-
const [innerOffset, setInnerOffset] = React.useState(0);
|
|
55
|
-
const [blockSelection, setBlockSelection] = React.useState(false);
|
|
56
|
-
const floatingStyle = React.useRef({});
|
|
57
|
-
React.useEffect(() => {
|
|
58
|
-
const frame = requestAnimationFrame(() => {
|
|
59
|
-
if (!open) {
|
|
60
|
-
setScrollTop(0);
|
|
61
|
-
setFallback(false);
|
|
62
|
-
setActiveIndex(null);
|
|
63
|
-
setControlledScrolling(false);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
return () => {
|
|
67
|
-
cancelAnimationFrame(frame);
|
|
68
|
-
};
|
|
69
|
-
}, [open, setActiveIndex]);
|
|
70
|
-
if (isWeb) {
|
|
71
|
-
React.useEffect(() => {
|
|
72
|
-
if (!open)
|
|
73
|
-
return;
|
|
74
|
-
const mouseUp = (e) => {
|
|
75
|
-
if (state.current.isMouseOutside) {
|
|
76
|
-
setOpen(false);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
document.addEventListener("mouseup", mouseUp);
|
|
80
|
-
return () => {
|
|
81
|
-
document.removeEventListener("mouseup", mouseUp);
|
|
82
|
-
};
|
|
83
|
-
}, [open]);
|
|
84
|
-
}
|
|
85
|
-
const updateFloatingSize = size({
|
|
86
|
-
apply({
|
|
87
|
-
availableHeight,
|
|
88
|
-
rects: {
|
|
89
|
-
reference: { width }
|
|
90
|
-
}
|
|
91
|
-
}) {
|
|
92
|
-
floatingStyle.current = {
|
|
93
|
-
width,
|
|
94
|
-
maxHeight: availableHeight
|
|
95
|
-
};
|
|
96
|
-
},
|
|
97
|
-
padding: WINDOW_PADDING
|
|
98
|
-
});
|
|
99
|
-
const { x, y, reference, floating, strategy, context, refs } = useFloating({
|
|
100
|
-
open,
|
|
101
|
-
onOpenChange: setOpen,
|
|
102
|
-
whileElementsMounted: autoUpdate,
|
|
103
|
-
placement: "bottom-start",
|
|
104
|
-
middleware: fallback ? [
|
|
105
|
-
offset(5),
|
|
106
|
-
...[
|
|
107
|
-
touch ? shift({ crossAxis: true, padding: WINDOW_PADDING }) : flip({ padding: WINDOW_PADDING })
|
|
108
|
-
],
|
|
109
|
-
updateFloatingSize
|
|
110
|
-
] : [
|
|
111
|
-
inner({
|
|
112
|
-
listRef: listItemsRef,
|
|
113
|
-
overflowRef,
|
|
114
|
-
index: selectedIndex,
|
|
115
|
-
offset: innerOffset,
|
|
116
|
-
onFallbackChange: setFallback,
|
|
117
|
-
padding: 10,
|
|
118
|
-
minItemsVisible: touch ? 10 : 4,
|
|
119
|
-
referenceOverflowThreshold: 20
|
|
120
|
-
}),
|
|
121
|
-
updateFloatingSize
|
|
122
|
-
]
|
|
123
|
-
});
|
|
124
|
-
const floatingRef = refs.floating;
|
|
125
|
-
const showUpArrow = open && scrollTop > SCROLL_ARROW_THRESHOLD;
|
|
126
|
-
const showDownArrow = open && floatingRef.current && scrollTop < floatingRef.current.scrollHeight - floatingRef.current.clientHeight - SCROLL_ARROW_THRESHOLD;
|
|
127
|
-
const interactions = useInteractions([
|
|
128
|
-
useClick(context, { event: "mousedown" }),
|
|
129
|
-
useDismiss(context, { outsidePress: false }),
|
|
130
|
-
useRole(context, { role: "listbox" }),
|
|
131
|
-
useInnerOffset(context, {
|
|
132
|
-
enabled: !fallback,
|
|
133
|
-
onChange: setInnerOffset,
|
|
134
|
-
overflowRef
|
|
135
|
-
}),
|
|
136
|
-
useListNavigation(context, {
|
|
137
|
-
listRef: listItemsRef,
|
|
138
|
-
activeIndex,
|
|
139
|
-
selectedIndex,
|
|
140
|
-
onNavigate: setActiveIndex
|
|
141
|
-
}),
|
|
142
|
-
useTypeahead(context, {
|
|
143
|
-
listRef: listContentRef,
|
|
144
|
-
onMatch: open ? setActiveIndex : setSelectedIndex,
|
|
145
|
-
selectedIndex,
|
|
146
|
-
activeIndex
|
|
147
|
-
})
|
|
148
|
-
]);
|
|
149
|
-
const interactionsContext = {
|
|
150
|
-
...interactions,
|
|
151
|
-
getReferenceProps() {
|
|
152
|
-
return interactions.getReferenceProps({
|
|
153
|
-
ref: reference,
|
|
154
|
-
className: "SelectTrigger",
|
|
155
|
-
onKeyDown(event) {
|
|
156
|
-
if (event.key === "Enter" || event.key === " " && !context.dataRef.current.typing) {
|
|
157
|
-
event.preventDefault();
|
|
158
|
-
setOpen(true);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
},
|
|
163
|
-
getFloatingProps(props2) {
|
|
164
|
-
return interactions.getFloatingProps({
|
|
165
|
-
ref: floating,
|
|
166
|
-
className: "Select",
|
|
167
|
-
...props2,
|
|
168
|
-
style: {
|
|
169
|
-
position: strategy,
|
|
170
|
-
top: y ?? "",
|
|
171
|
-
left: x ?? "",
|
|
172
|
-
outline: 0,
|
|
173
|
-
listStyleType: "none",
|
|
174
|
-
scrollbarWidth: "none",
|
|
175
|
-
...floatingStyle.current,
|
|
176
|
-
...props2 == null ? void 0 : props2.style
|
|
177
|
-
},
|
|
178
|
-
onPointerEnter() {
|
|
179
|
-
setControlledScrolling(false);
|
|
180
|
-
state.current.isMouseOutside = false;
|
|
181
|
-
},
|
|
182
|
-
onPointerLeave() {
|
|
183
|
-
state.current.isMouseOutside = true;
|
|
184
|
-
},
|
|
185
|
-
onPointerMove() {
|
|
186
|
-
state.current.isMouseOutside = false;
|
|
187
|
-
setControlledScrolling(false);
|
|
188
|
-
},
|
|
189
|
-
onKeyDown() {
|
|
190
|
-
setControlledScrolling(true);
|
|
191
|
-
},
|
|
192
|
-
onContextMenu(e) {
|
|
193
|
-
e.preventDefault();
|
|
194
|
-
},
|
|
195
|
-
onScroll(event) {
|
|
196
|
-
flushSync(() => setScrollTop(event.currentTarget.scrollTop));
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
useIsomorphicLayoutEffect(() => {
|
|
202
|
-
if (open) {
|
|
203
|
-
selectTimeoutRef.current = setTimeout(() => {
|
|
204
|
-
allowSelectRef.current = true;
|
|
205
|
-
}, 300);
|
|
206
|
-
return () => {
|
|
207
|
-
clearTimeout(selectTimeoutRef.current);
|
|
208
|
-
};
|
|
209
|
-
} else {
|
|
210
|
-
allowSelectRef.current = false;
|
|
211
|
-
allowMouseUpRef.current = true;
|
|
212
|
-
setInnerOffset(0);
|
|
213
|
-
setFallback(false);
|
|
214
|
-
setBlockSelection(false);
|
|
215
|
-
}
|
|
216
|
-
}, [open]);
|
|
217
|
-
useIsomorphicLayoutEffect(() => {
|
|
218
|
-
function onPointerDown(e) {
|
|
219
|
-
var _a, _b, _c;
|
|
220
|
-
const target = e.target;
|
|
221
|
-
if (!(((_a = refs.floating.current) == null ? void 0 : _a.contains(target)) || ((_b = upArrowRef.current) == null ? void 0 : _b.contains(target)) || ((_c = downArrowRef.current) == null ? void 0 : _c.contains(target)))) {
|
|
222
|
-
setOpen(false);
|
|
223
|
-
setControlledScrolling(false);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (open) {
|
|
227
|
-
document.addEventListener("pointerdown", onPointerDown);
|
|
228
|
-
return () => {
|
|
229
|
-
document.removeEventListener("pointerdown", onPointerDown);
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
}, [open, refs, setOpen]);
|
|
233
|
-
useIsomorphicLayoutEffect(() => {
|
|
234
|
-
var _a, _b;
|
|
235
|
-
if (open && controlledScrolling) {
|
|
236
|
-
if (activeIndex != null) {
|
|
237
|
-
(_a = listItemsRef.current[activeIndex]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
setScrollTop(((_b = refs.floating.current) == null ? void 0 : _b.scrollTop) ?? 0);
|
|
241
|
-
}, [open, refs, controlledScrolling, activeIndex]);
|
|
242
|
-
useIsomorphicLayoutEffect(() => {
|
|
243
|
-
var _a;
|
|
244
|
-
if (open && fallback) {
|
|
245
|
-
if (selectedIndex != null) {
|
|
246
|
-
(_a = listItemsRef.current[selectedIndex]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}, [open, fallback, selectedIndex]);
|
|
250
|
-
useIsomorphicLayoutEffect(() => {
|
|
251
|
-
if (refs.floating.current && fallback) {
|
|
252
|
-
refs.floating.current.style.maxHeight = "";
|
|
253
|
-
}
|
|
254
|
-
}, [refs, fallback]);
|
|
255
|
-
return /* @__PURE__ */ jsx(SelectProvider, {
|
|
256
|
-
scope: __scopeSelect,
|
|
257
|
-
...selectContext,
|
|
258
|
-
setScrollTop,
|
|
259
|
-
setInnerOffset,
|
|
260
|
-
floatingRef,
|
|
261
|
-
setValueAtIndex: (index, value) => {
|
|
262
|
-
listContentRef.current[index] = value;
|
|
263
|
-
},
|
|
264
|
-
fallback,
|
|
265
|
-
interactions: interactionsContext,
|
|
266
|
-
floatingContext: context,
|
|
267
|
-
activeIndex,
|
|
268
|
-
canScrollDown: !!showDownArrow,
|
|
269
|
-
canScrollUp: !!showUpArrow,
|
|
270
|
-
controlledScrolling: true,
|
|
271
|
-
dataRef: context.dataRef,
|
|
272
|
-
listRef: listItemsRef,
|
|
273
|
-
blockSelection,
|
|
274
|
-
allowMouseUpRef,
|
|
275
|
-
upArrowRef,
|
|
276
|
-
downArrowRef,
|
|
277
|
-
selectTimeoutRef,
|
|
278
|
-
allowSelectRef,
|
|
279
|
-
children
|
|
280
|
-
});
|
|
281
|
-
};
|
|
282
|
-
const userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
|
|
283
|
-
export {
|
|
284
|
-
SelectInlineImpl
|
|
285
|
-
};
|
|
286
|
-
//# sourceMappingURL=SelectImpl.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/SelectImpl.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n SideObject,\n autoUpdate,\n flip,\n inner,\n offset,\n shift,\n size,\n useClick,\n useDismiss,\n useFloating,\n useInnerOffset,\n useInteractions,\n useListNavigation,\n useRole,\n useTypeahead,\n} from '@floating-ui/react-dom-interactions'\nimport { isWeb, useIsTouchDevice, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport * as React from 'react'\nimport { flushSync } from 'react-dom'\n\nimport { SCROLL_ARROW_THRESHOLD, WINDOW_PADDING } from './constants'\nimport { SelectProvider, useSelectContext } from './context'\nimport { SelectImplProps } from './types'\n\n// TODO use id for focusing from label\nexport const SelectInlineImpl = (props: SelectImplProps) => {\n const {\n __scopeSelect,\n children,\n open = false,\n selectedIndexRef,\n listContentRef,\n } = props\n\n const selectContext = useSelectContext('SelectSheetImpl', __scopeSelect)\n const {\n setActiveIndex,\n setOpen,\n setSelectedIndex,\n selectedIndex,\n activeIndex,\n forceUpdate,\n } = selectContext\n const [scrollTop, setScrollTop] = React.useState(0)\n const touch = useIsTouchDevice()\n\n const listItemsRef = React.useRef<Array<HTMLElement | null>>([])\n const overflowRef = React.useRef<null | SideObject>(null)\n const upArrowRef = React.useRef<HTMLDivElement | null>(null)\n const downArrowRef = React.useRef<HTMLDivElement | null>(null)\n const allowSelectRef = React.useRef(false)\n const allowMouseUpRef = React.useRef(true)\n const selectTimeoutRef = React.useRef<any>()\n const state = React.useRef({\n isMouseOutside: false,\n })\n\n const [controlledScrolling, setControlledScrolling] = React.useState(false)\n const [fallback, setFallback] = React.useState(false)\n const [innerOffset, setInnerOffset] = React.useState(0)\n const [blockSelection, setBlockSelection] = React.useState(false)\n const floatingStyle = React.useRef({})\n\n // Wait for scroll position to settle before showing arrows to prevent\n // interference with pointer events.\n React.useEffect(() => {\n const frame = requestAnimationFrame(() => {\n if (!open) {\n setScrollTop(0)\n setFallback(false)\n setActiveIndex(null)\n setControlledScrolling(false)\n }\n })\n return () => {\n cancelAnimationFrame(frame)\n }\n }, [open, setActiveIndex])\n\n // close when mouseup outside select\n if (isWeb) {\n React.useEffect(() => {\n if (!open) return\n const mouseUp = (e: MouseEvent) => {\n if (state.current.isMouseOutside) {\n setOpen(false)\n }\n }\n document.addEventListener('mouseup', mouseUp)\n return () => {\n document.removeEventListener('mouseup', mouseUp)\n }\n }, [open])\n }\n\n const updateFloatingSize = size({\n apply({\n availableHeight,\n rects: {\n reference: { width },\n },\n }) {\n floatingStyle.current = {\n width: width,\n maxHeight: availableHeight,\n }\n },\n padding: WINDOW_PADDING,\n })\n\n const { x, y, reference, floating, strategy, context, refs } = useFloating({\n open,\n onOpenChange: setOpen,\n whileElementsMounted: autoUpdate,\n placement: 'bottom-start',\n middleware: fallback\n ? [\n offset(5),\n ...[\n touch\n ? shift({ crossAxis: true, padding: WINDOW_PADDING })\n : flip({ padding: WINDOW_PADDING }),\n ],\n updateFloatingSize,\n ]\n : [\n inner({\n listRef: listItemsRef,\n overflowRef,\n index: selectedIndex,\n offset: innerOffset,\n onFallbackChange: setFallback,\n padding: 10,\n minItemsVisible: touch ? 10 : 4,\n referenceOverflowThreshold: 20,\n }),\n updateFloatingSize,\n ],\n })\n\n const floatingRef = refs.floating\n\n const showUpArrow = open && scrollTop > SCROLL_ARROW_THRESHOLD\n const showDownArrow =\n open &&\n floatingRef.current &&\n scrollTop <\n floatingRef.current.scrollHeight -\n floatingRef.current.clientHeight -\n SCROLL_ARROW_THRESHOLD\n\n const interactions = useInteractions([\n useClick(context, { event: 'mousedown' }),\n useDismiss(context, { outsidePress: false }),\n useRole(context, { role: 'listbox' }),\n useInnerOffset(context, {\n enabled: !fallback,\n onChange: setInnerOffset,\n overflowRef,\n }),\n useListNavigation(context, {\n listRef: listItemsRef,\n activeIndex,\n selectedIndex,\n onNavigate: setActiveIndex,\n }),\n useTypeahead(context, {\n listRef: listContentRef,\n onMatch: open ? setActiveIndex : setSelectedIndex,\n selectedIndex,\n activeIndex,\n }),\n ])\n\n const interactionsContext = {\n ...interactions,\n getReferenceProps() {\n return interactions.getReferenceProps({\n ref: reference,\n className: 'SelectTrigger',\n onKeyDown(event) {\n if (\n event.key === 'Enter' ||\n (event.key === ' ' && !context.dataRef.current.typing)\n ) {\n event.preventDefault()\n setOpen(true)\n }\n },\n })\n },\n getFloatingProps(props) {\n return interactions.getFloatingProps({\n ref: floating,\n className: 'Select',\n ...props,\n style: {\n position: strategy,\n top: y ?? '',\n left: x ?? '',\n outline: 0,\n listStyleType: 'none',\n scrollbarWidth: 'none',\n ...floatingStyle.current,\n ...props?.style,\n },\n onPointerEnter() {\n setControlledScrolling(false)\n state.current.isMouseOutside = false\n },\n onPointerLeave() {\n state.current.isMouseOutside = true\n },\n onPointerMove() {\n state.current.isMouseOutside = false\n setControlledScrolling(false)\n },\n onKeyDown() {\n setControlledScrolling(true)\n },\n onContextMenu(e) {\n e.preventDefault()\n },\n onScroll(event) {\n // In React 18, the ScrollArrows need to synchronously know this value to prevent\n // painting at the wrong time.\n flushSync(() => setScrollTop(event.currentTarget.scrollTop))\n },\n })\n },\n }\n\n // effects\n\n useIsomorphicLayoutEffect(() => {\n if (open) {\n selectTimeoutRef.current = setTimeout(() => {\n allowSelectRef.current = true\n }, 300)\n\n return () => {\n clearTimeout(selectTimeoutRef.current)\n }\n } else {\n allowSelectRef.current = false\n allowMouseUpRef.current = true\n setInnerOffset(0)\n setFallback(false)\n setBlockSelection(false)\n }\n }, [open])\n\n // Replacement for `useDismiss` as the arrows are outside of the floating\n // element DOM tree.\n useIsomorphicLayoutEffect(() => {\n function onPointerDown(e: PointerEvent) {\n const target = e.target as Node\n if (\n !(\n refs.floating.current?.contains(target) ||\n upArrowRef.current?.contains(target) ||\n downArrowRef.current?.contains(target)\n )\n ) {\n setOpen(false)\n setControlledScrolling(false)\n }\n }\n\n if (open) {\n document.addEventListener('pointerdown', onPointerDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n }\n }\n }, [open, refs, setOpen])\n\n // Scroll the `activeIndex` item into view only in \"controlledScrolling\"\n // (keyboard nav) mode.\n useIsomorphicLayoutEffect(() => {\n if (open && controlledScrolling) {\n if (activeIndex != null) {\n listItemsRef.current[activeIndex]?.scrollIntoView({ block: 'nearest' })\n }\n }\n\n setScrollTop(refs.floating.current?.scrollTop ?? 0)\n }, [open, refs, controlledScrolling, activeIndex])\n\n // Scroll the `selectedIndex` into view upon opening the floating element.\n useIsomorphicLayoutEffect(() => {\n if (open && fallback) {\n if (selectedIndex != null) {\n listItemsRef.current[selectedIndex]?.scrollIntoView({ block: 'nearest' })\n }\n }\n }, [open, fallback, selectedIndex])\n\n // Unset the height limiting for fallback mode. This gets executed prior to\n // the positioning call.\n useIsomorphicLayoutEffect(() => {\n if (refs.floating.current && fallback) {\n refs.floating.current.style.maxHeight = ''\n }\n }, [refs, fallback])\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 {...(selectContext as Required<typeof selectContext>)}\n setScrollTop={setScrollTop}\n setInnerOffset={setInnerOffset}\n floatingRef={floatingRef}\n setValueAtIndex={(index, value) => {\n listContentRef.current[index] = value\n }}\n fallback={fallback}\n interactions={interactionsContext}\n floatingContext={context}\n activeIndex={activeIndex}\n canScrollDown={!!showDownArrow}\n canScrollUp={!!showUpArrow}\n controlledScrolling\n dataRef={context.dataRef}\n listRef={listItemsRef}\n blockSelection={blockSelection}\n allowMouseUpRef={allowMouseUpRef}\n upArrowRef={upArrowRef}\n downArrowRef={downArrowRef}\n selectTimeoutRef={selectTimeoutRef}\n allowSelectRef={allowSelectRef}\n >\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\n// Cross browser fixes for pinch-zooming/backdrop-filter \uD83D\uDE44\nconst userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || ''\n"],
|
|
5
|
-
"mappings": "AAyTI;AAzTJ;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,kBAAkB,iCAAiC;AACnE,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAE1B,SAAS,wBAAwB,sBAAsB;AACvD,SAAS,gBAAgB,wBAAwB;AAI1C,MAAM,mBAAmB,CAAC,UAA2B;AAC1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,gBAAgB,iBAAiB,mBAAmB,aAAa;AACvE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,CAAC;AAClD,QAAM,QAAQ,iBAAiB;AAE/B,QAAM,eAAe,MAAM,OAAkC,CAAC,CAAC;AAC/D,QAAM,cAAc,MAAM,OAA0B,IAAI;AACxD,QAAM,aAAa,MAAM,OAA8B,IAAI;AAC3D,QAAM,eAAe,MAAM,OAA8B,IAAI;AAC7D,QAAM,iBAAiB,MAAM,OA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nB,SACE,oBAAC;AAAA,IACC,OAAO;AAAA,IACN,GAAI;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB,CAAC,OAAO,UAAU;AACjC,qBAAe,QAAQ,SAAS;AAAA,IAClC;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB;AAAA,IACA,eAAe,CAAC,CAAC;AAAA,IACjB,aAAa,CAAC,CAAC;AAAA,IACf,qBAAmB;AAAA,IACnB,SAAS,QAAQ;AAAA,IACjB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEC;AAAA,GAaH;AAEJ;AAGA,MAAM,YAAa,OAAO,cAAc,eAAe,UAAU,aAAc;",
|
|
6
|
-
"names": ["props"]
|
|
7
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
const SelectInlineImpl = (props) => {
|
|
3
|
-
if (process.env.NODE_ENV === "development") {
|
|
4
|
-
console.warn("Sheet not implemented inline on native");
|
|
5
|
-
}
|
|
6
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
7
|
-
children: props.children
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
SelectInlineImpl
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=SelectImpl.native.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/SelectImpl.native.tsx"],
|
|
4
|
-
"sourcesContent": ["import { SelectImplProps } from './types'\n\n/**\n * TODO can just make it a sheet for native\n * later on can have `native` prop\n */\n\nexport const SelectInlineImpl = (props: SelectImplProps) => {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('Sheet not implemented inline on native')\n }\n return <>{props.children}</>\n}\n"],
|
|
5
|
-
"mappings": "AAYS;AALF,MAAM,mBAAmB,CAAC,UAA2B;AAC1D,MAAI,QAAQ,IAAI,aAAa,eAAe;AAE1C,YAAQ,KAAK,wCAAwC;AAAA,EACvD;AACA,SAAO;AAAA,IAAG,gBAAM;AAAA,GAAS;AAC3B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { autoUpdate, offset, useFloating } from "@floating-ui/react-dom-interactions";
|
|
3
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
4
|
-
import { useIsomorphicLayoutEffect } from "@tamagui/core";
|
|
5
|
-
import { YStack } from "@tamagui/stacks";
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
import { flushSync } from "react-dom";
|
|
8
|
-
import { useSelectContext } from "./context";
|
|
9
|
-
const SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton";
|
|
10
|
-
const SelectScrollUpButton = React.forwardRef((props, forwardedRef) => {
|
|
11
|
-
return /* @__PURE__ */ jsx(SelectScrollButtonImpl, {
|
|
12
|
-
componentName: SCROLL_UP_BUTTON_NAME,
|
|
13
|
-
...props,
|
|
14
|
-
dir: "up",
|
|
15
|
-
ref: forwardedRef
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
SelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;
|
|
19
|
-
const SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton";
|
|
20
|
-
const SelectScrollDownButton = React.forwardRef((props, forwardedRef) => {
|
|
21
|
-
return /* @__PURE__ */ jsx(SelectScrollButtonImpl, {
|
|
22
|
-
componentName: SCROLL_DOWN_BUTTON_NAME,
|
|
23
|
-
...props,
|
|
24
|
-
dir: "down",
|
|
25
|
-
ref: forwardedRef
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
SelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
29
|
-
const SelectScrollButtonImpl = React.memo(
|
|
30
|
-
React.forwardRef(
|
|
31
|
-
(props, forwardedRef) => {
|
|
32
|
-
var _a;
|
|
33
|
-
const { __scopeSelect, dir, componentName, ...scrollIndicatorProps } = props;
|
|
34
|
-
const {
|
|
35
|
-
floatingRef,
|
|
36
|
-
forceUpdate,
|
|
37
|
-
open,
|
|
38
|
-
fallback,
|
|
39
|
-
setScrollTop,
|
|
40
|
-
setInnerOffset,
|
|
41
|
-
...context
|
|
42
|
-
} = useSelectContext(componentName, __scopeSelect);
|
|
43
|
-
const [element, setElement] = React.useState(null);
|
|
44
|
-
const statusRef = React.useRef("idle");
|
|
45
|
-
const isVisible = context[dir === "down" ? "canScrollDown" : "canScrollUp"];
|
|
46
|
-
const frameRef = React.useRef();
|
|
47
|
-
const { x, y, reference, floating, strategy, update, refs } = useFloating({
|
|
48
|
-
strategy: "fixed",
|
|
49
|
-
placement: dir === "up" ? "top" : "bottom",
|
|
50
|
-
middleware: [offset(({ rects }) => -rects.floating.height)],
|
|
51
|
-
whileElementsMounted: (...args) => autoUpdate(...args, { animationFrame: true })
|
|
52
|
-
});
|
|
53
|
-
const composedRef = useComposedRefs(forwardedRef, floating);
|
|
54
|
-
if (floatingRef) {
|
|
55
|
-
if (open) {
|
|
56
|
-
if (element !== floatingRef.current) {
|
|
57
|
-
setElement(floatingRef.current);
|
|
58
|
-
reference(floatingRef.current);
|
|
59
|
-
requestAnimationFrame(update);
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
cancelAnimationFrame(frameRef.current);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
useIsomorphicLayoutEffect(() => {
|
|
66
|
-
return () => {
|
|
67
|
-
cancelAnimationFrame(frameRef.current);
|
|
68
|
-
};
|
|
69
|
-
}, []);
|
|
70
|
-
if (!(isVisible && floatingRef)) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
const onScroll = (amount) => {
|
|
74
|
-
if (fallback) {
|
|
75
|
-
if (refs.floating.current) {
|
|
76
|
-
refs.floating.current.scrollTop -= amount;
|
|
77
|
-
flushSync(() => {
|
|
78
|
-
var _a2;
|
|
79
|
-
return setScrollTop(((_a2 = refs.floating.current) == null ? void 0 : _a2.scrollTop) ?? 0);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
flushSync(() => setInnerOffset((value) => value - amount));
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
return /* @__PURE__ */ jsx(YStack, {
|
|
87
|
-
ref: composedRef,
|
|
88
|
-
componentName,
|
|
89
|
-
"aria-hidden": true,
|
|
90
|
-
...scrollIndicatorProps,
|
|
91
|
-
zIndex: 1e3,
|
|
92
|
-
position: strategy,
|
|
93
|
-
left: x || 0,
|
|
94
|
-
top: y || 0,
|
|
95
|
-
width: `calc(${(((_a = floatingRef == null ? void 0 : floatingRef.current) == null ? void 0 : _a.offsetWidth) ?? 0) - 2}px)`,
|
|
96
|
-
onPointerEnter: () => {
|
|
97
|
-
statusRef.current = "active";
|
|
98
|
-
let prevNow = Date.now();
|
|
99
|
-
function frame() {
|
|
100
|
-
if (element) {
|
|
101
|
-
const currentNow = Date.now();
|
|
102
|
-
const msElapsed = currentNow - prevNow;
|
|
103
|
-
prevNow = currentNow;
|
|
104
|
-
const pixelsToScroll = msElapsed / 2;
|
|
105
|
-
const remainingPixels = dir === "up" ? element.scrollTop : element.scrollHeight - element.clientHeight - element.scrollTop;
|
|
106
|
-
const scrollRemaining = dir === "up" ? element.scrollTop - pixelsToScroll > 0 : element.scrollTop + pixelsToScroll < element.scrollHeight - element.clientHeight;
|
|
107
|
-
onScroll(
|
|
108
|
-
dir === "up" ? Math.min(pixelsToScroll, remainingPixels) : Math.max(-pixelsToScroll, -remainingPixels)
|
|
109
|
-
);
|
|
110
|
-
if (scrollRemaining) {
|
|
111
|
-
frameRef.current = requestAnimationFrame(frame);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
cancelAnimationFrame(frameRef.current);
|
|
116
|
-
frameRef.current = requestAnimationFrame(frame);
|
|
117
|
-
},
|
|
118
|
-
onPointerLeave: () => {
|
|
119
|
-
statusRef.current = "idle";
|
|
120
|
-
cancelAnimationFrame(frameRef.current);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
)
|
|
125
|
-
);
|
|
126
|
-
export {
|
|
127
|
-
SelectScrollDownButton,
|
|
128
|
-
SelectScrollUpButton
|
|
129
|
-
};
|
|
130
|
-
//# sourceMappingURL=SelectScrollButton.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/SelectScrollButton.tsx"],
|
|
4
|
-
"sourcesContent": ["import { autoUpdate, offset, useFloating } from '@floating-ui/react-dom-interactions'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { TamaguiElement, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { flushSync } from 'react-dom'\n\nimport { useSelectContext } from './context'\nimport {\n ScopedProps,\n SelectScrollButtonImplProps,\n SelectScrollButtonProps,\n} from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollUpButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton'\n\nexport const SelectScrollUpButton = React.forwardRef<\n TamaguiElement,\n SelectScrollButtonProps\n>((props: ScopedProps<SelectScrollButtonProps>, forwardedRef) => {\n return (\n <SelectScrollButtonImpl\n componentName={SCROLL_UP_BUTTON_NAME}\n {...props}\n dir=\"up\"\n ref={forwardedRef}\n />\n )\n})\n\nSelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollDownButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton'\n\nexport const SelectScrollDownButton = React.forwardRef<\n TamaguiElement,\n SelectScrollButtonProps\n>((props: ScopedProps<SelectScrollButtonProps>, forwardedRef) => {\n return (\n <SelectScrollButtonImpl\n componentName={SCROLL_DOWN_BUTTON_NAME}\n {...props}\n dir=\"down\"\n ref={forwardedRef}\n />\n )\n})\n\nSelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME\n\ntype SelectScrollButtonImplElement = TamaguiElement\n\nconst SelectScrollButtonImpl = React.memo(\n React.forwardRef<SelectScrollButtonImplElement, SelectScrollButtonImplProps>(\n (props: ScopedProps<SelectScrollButtonImplProps>, forwardedRef) => {\n const { __scopeSelect, dir, componentName, ...scrollIndicatorProps } = props\n const {\n floatingRef,\n forceUpdate,\n open,\n fallback,\n setScrollTop,\n setInnerOffset,\n ...context\n } = useSelectContext(componentName, __scopeSelect)\n\n const [element, setElement] = React.useState<HTMLElement | null>(null)\n const statusRef = React.useRef<'idle' | 'active'>('idle')\n const isVisible = context[dir === 'down' ? 'canScrollDown' : 'canScrollUp']\n const frameRef = React.useRef<any>()\n\n const { x, y, reference, floating, strategy, update, refs } = useFloating({\n strategy: 'fixed',\n placement: dir === 'up' ? 'top' : 'bottom',\n middleware: [offset(({ rects }) => -rects.floating.height)],\n whileElementsMounted: (...args) => autoUpdate(...args, { animationFrame: true }),\n })\n\n const composedRef = useComposedRefs(forwardedRef, floating)\n\n if (floatingRef) {\n if (open) {\n if (element !== floatingRef.current) {\n setElement(floatingRef.current)\n reference(floatingRef.current)\n requestAnimationFrame(update)\n }\n } else {\n cancelAnimationFrame(frameRef.current)\n }\n }\n\n useIsomorphicLayoutEffect(() => {\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n cancelAnimationFrame(frameRef.current)\n }\n }, [])\n\n if (!(isVisible && floatingRef)) {\n return null\n }\n\n const onScroll = (amount: number) => {\n if (fallback) {\n if (refs.floating.current) {\n refs.floating.current.scrollTop -= amount\n flushSync(() => setScrollTop!(refs.floating.current?.scrollTop ?? 0))\n }\n } else {\n flushSync(() => setInnerOffset!((value) => value - amount))\n }\n }\n\n return (\n <YStack\n ref={composedRef}\n componentName={componentName}\n aria-hidden\n {...scrollIndicatorProps}\n zIndex={1000}\n // @ts-expect-error\n position={strategy}\n left={x || 0}\n top={y || 0}\n width={`calc(${(floatingRef?.current?.offsetWidth ?? 0) - 2}px)`}\n onPointerEnter={() => {\n statusRef.current = 'active'\n let prevNow = Date.now()\n\n function frame() {\n if (element) {\n const currentNow = Date.now()\n const msElapsed = currentNow - prevNow\n prevNow = currentNow\n\n const pixelsToScroll = msElapsed / 2\n\n const remainingPixels =\n dir === 'up'\n ? element.scrollTop\n : element.scrollHeight - element.clientHeight - element.scrollTop\n\n const scrollRemaining =\n dir === 'up'\n ? element.scrollTop - pixelsToScroll > 0\n : element.scrollTop + pixelsToScroll <\n element.scrollHeight - element.clientHeight\n\n onScroll(\n dir === 'up'\n ? Math.min(pixelsToScroll, remainingPixels)\n : Math.max(-pixelsToScroll, -remainingPixels)\n )\n\n if (scrollRemaining) {\n frameRef.current = requestAnimationFrame(frame)\n }\n }\n }\n\n cancelAnimationFrame(frameRef.current)\n frameRef.current = requestAnimationFrame(frame)\n }}\n onPointerLeave={() => {\n statusRef.current = 'idle'\n cancelAnimationFrame(frameRef.current)\n }}\n />\n )\n }\n )\n)\n"],
|
|
5
|
-
"mappings": "AAyBI;AAzBJ,SAAS,YAAY,QAAQ,mBAAmB;AAChD,SAAS,uBAAuB;AAChC,SAAyB,iCAAiC;AAC1D,SAAS,cAAc;AACvB,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAE1B,SAAS,wBAAwB;AAWjC,MAAM,wBAAwB;AAEvB,MAAM,uBAAuB,MAAM,WAGxC,CAAC,OAA6C,iBAAiB;AAC/D,SACE,oBAAC;AAAA,IACC,eAAe;AAAA,IACd,GAAG;AAAA,IACJ,KAAI;AAAA,IACJ,KAAK;AAAA,GACP;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAMnC,MAAM,0BAA0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UAAU,sBAAsB,KAAK;AAAA,cAChD;AAAA,YACF;AAAA,UACF;AAEA,+BAAqB,SAAS,OAAO;AACrC,mBAAS,UAAU,sBAAsB,KAAK;AAAA,QAChD;AAAA,QACA,gBAAgB,MAAM;AACpB,oBAAU,UAAU;AACpB,+BAAqB,SAAS,OAAO;AAAA,QACvC;AAAA,OACF;AAAA,IAEJ;AAAA,EACF;AACF;",
|
|
6
|
-
"names": ["_a"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/SelectScrollButton.native.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ScopedProps, SelectScrollButtonProps } from './types'\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const SelectScrollUpButton = (_: ScopedProps<SelectScrollButtonProps>) => null\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const SelectScrollDownButton = (_: ScopedProps<SelectScrollButtonProps>) =>\n null\n"],
|
|
5
|
-
"mappings": "AAGO,MAAM,uBAAuB,CAAC,MAA4C;AAG1E,MAAM,yBAAyB,CAAC,MACrC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FloatingFocusManager } from "@floating-ui/react-dom-interactions";
|
|
3
|
-
import { isWeb } from "@tamagui/core";
|
|
4
|
-
import { styled } from "@tamagui/core";
|
|
5
|
-
import { PortalItem } from "@tamagui/portal";
|
|
6
|
-
import { ThemeableStack } from "@tamagui/stacks";
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import { VIEWPORT_NAME } from "./constants";
|
|
9
|
-
import { ForwardSelectContext, useSelectContext } from "./context";
|
|
10
|
-
import { useSelectBreakpointActive } from "./useSelectBreakpointActive";
|
|
11
|
-
const SelectViewportFrame = styled(ThemeableStack, {
|
|
12
|
-
name: VIEWPORT_NAME,
|
|
13
|
-
backgroundColor: "$background",
|
|
14
|
-
elevate: true,
|
|
15
|
-
bordered: true,
|
|
16
|
-
overflow: "scroll",
|
|
17
|
-
userSelect: "none",
|
|
18
|
-
outlineWidth: 0,
|
|
19
|
-
variants: {
|
|
20
|
-
size: {
|
|
21
|
-
"...size": (val, { tokens }) => {
|
|
22
|
-
return {
|
|
23
|
-
borderRadius: tokens.radius[val] ?? val
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
defaultVariants: {
|
|
29
|
-
size: "$2"
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const SelectViewport = React.forwardRef(
|
|
33
|
-
(props, forwardedRef) => {
|
|
34
|
-
const { __scopeSelect, children, ...viewportProps } = props;
|
|
35
|
-
const context = useSelectContext(VIEWPORT_NAME, __scopeSelect);
|
|
36
|
-
const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
|
|
37
|
-
if (breakpointActive || !isWeb) {
|
|
38
|
-
return /* @__PURE__ */ jsx(PortalItem, {
|
|
39
|
-
hostName: `${context.scopeKey}SheetContents`,
|
|
40
|
-
children: /* @__PURE__ */ jsx(ForwardSelectContext, {
|
|
41
|
-
context,
|
|
42
|
-
children
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
if (!context.floatingContext) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
if (!context.open) {
|
|
50
|
-
return children;
|
|
51
|
-
}
|
|
52
|
-
const {
|
|
53
|
-
style: { scrollbarWidth, listStyleType, ...restStyle },
|
|
54
|
-
...floatingProps
|
|
55
|
-
} = context.interactions.getFloatingProps();
|
|
56
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
57
|
-
children: [
|
|
58
|
-
/* @__PURE__ */ jsx("style", {
|
|
59
|
-
dangerouslySetInnerHTML: {
|
|
60
|
-
__html: selectViewportCSS
|
|
61
|
-
}
|
|
62
|
-
}),
|
|
63
|
-
/* @__PURE__ */ jsx(FloatingFocusManager, {
|
|
64
|
-
context: context.floatingContext,
|
|
65
|
-
children: /* @__PURE__ */ jsx(SelectViewportFrame, {
|
|
66
|
-
size: context.size,
|
|
67
|
-
role: "presentation",
|
|
68
|
-
...viewportProps,
|
|
69
|
-
ref: forwardedRef,
|
|
70
|
-
...floatingProps,
|
|
71
|
-
...restStyle,
|
|
72
|
-
children
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
]
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
SelectViewport.displayName = VIEWPORT_NAME;
|
|
80
|
-
const selectViewportCSS = `
|
|
81
|
-
.is_SelectViewport {
|
|
82
|
-
scrollbar-width: none;
|
|
83
|
-
-webkit-overflow-scrolling: touch;
|
|
84
|
-
overscroll-behavior: contain;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.is_SelectViewport::-webkit-scrollbar{
|
|
88
|
-
display:none
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
91
|
-
export {
|
|
92
|
-
SelectViewport,
|
|
93
|
-
SelectViewportFrame
|
|
94
|
-
};
|
|
95
|
-
//# sourceMappingURL=SelectViewport.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/SelectViewport.tsx"],
|
|
4
|
-
"sourcesContent": ["import { FloatingFocusManager } from '@floating-ui/react-dom-interactions'\nimport { TamaguiElement, isWeb } from '@tamagui/core'\nimport { styled } from '@tamagui/core'\nimport { PortalItem } from '@tamagui/portal'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport * as React from 'react'\n\nimport { VIEWPORT_NAME } from './constants'\nimport { ForwardSelectContext, useSelectContext } from './context'\nimport { ScopedProps, SelectViewportProps } from './types'\nimport { useSelectBreakpointActive } from './useSelectBreakpointActive'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectViewport\n * -----------------------------------------------------------------------------------------------*/\n\nexport const SelectViewportFrame = styled(ThemeableStack, {\n name: VIEWPORT_NAME,\n backgroundColor: '$background',\n elevate: true,\n bordered: true,\n overflow: 'scroll',\n userSelect: 'none',\n outlineWidth: 0,\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n borderRadius: tokens.radius[val] ?? val,\n }\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$2',\n },\n})\n\nexport const SelectViewport = React.forwardRef<TamaguiElement, SelectViewportProps>(\n (props: ScopedProps<SelectViewportProps>, forwardedRef) => {\n const { __scopeSelect, children, ...viewportProps } = props\n const context = useSelectContext(VIEWPORT_NAME, __scopeSelect)\n const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint)\n\n if (breakpointActive || !isWeb) {\n return (\n <PortalItem hostName={`${context.scopeKey}SheetContents`}>\n <ForwardSelectContext context={context}>{children}</ForwardSelectContext>\n </PortalItem>\n )\n }\n\n if (!context.floatingContext) {\n return null\n }\n\n if (!context.open) {\n return children\n }\n\n const {\n style: { scrollbarWidth, listStyleType, ...restStyle },\n ...floatingProps\n } = context.interactions!.getFloatingProps()\n\n return (\n <>\n <style\n dangerouslySetInnerHTML={{\n __html: selectViewportCSS,\n }}\n />\n <FloatingFocusManager context={context.floatingContext}>\n <SelectViewportFrame\n size={context.size}\n // @ts-ignore\n role=\"presentation\"\n {...viewportProps}\n ref={forwardedRef}\n {...floatingProps}\n {...restStyle}\n >\n {children}\n </SelectViewportFrame>\n </FloatingFocusManager>\n </>\n )\n }\n)\n\nSelectViewport.displayName = VIEWPORT_NAME\n\nconst selectViewportCSS = `\n.is_SelectViewport {\n scrollbar-width: none;\n -webkit-overflow-scrolling: touch;\n overscroll-behavior: contain;\n}\n\n.is_SelectViewport::-webkit-scrollbar{\n display:none\n}\n`\n"],
|
|
5
|
-
"mappings": "AAiDU,SAmBJ,UAnBI,KAmBJ,YAnBI;AAjDV,SAAS,4BAA4B;AACrC,SAAyB,aAAa;AACtC,SAAS,cAAc;AACvB,S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AAQ;AAAA,UACrC,8BAAC;AAAA,YACC,MAAM,QAAQ;AAAA,YAEd,MAAK;AAAA,YACJ,GAAG;AAAA,YACJ,KAAK;AAAA,YACJ,GAAG;AAAA,YACH,GAAG;AAAA,YAEH;AAAA,WACH;AAAA,SACF;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,eAAe,cAAc;AAE7B,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AdaptParentContext } from "@tamagui/adapt";
|
|
3
|
-
import { Theme, useThemeName } from "@tamagui/core";
|
|
4
|
-
import { PortalItem } from "@tamagui/portal";
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
import { VIEWPORT_NAME } from "./constants";
|
|
7
|
-
import { SelectProvider, useSelectContext } from "./context";
|
|
8
|
-
const SelectViewport = (props) => {
|
|
9
|
-
const { __scopeSelect, children } = props;
|
|
10
|
-
const context = useSelectContext(VIEWPORT_NAME, __scopeSelect);
|
|
11
|
-
const themeName = useThemeName();
|
|
12
|
-
const adaptContext = React.useContext(AdaptParentContext);
|
|
13
|
-
return /* @__PURE__ */ jsx(PortalItem, {
|
|
14
|
-
hostName: `${context.scopeKey}SheetContents`,
|
|
15
|
-
children: /* @__PURE__ */ jsx(Theme, {
|
|
16
|
-
name: themeName,
|
|
17
|
-
children: /* @__PURE__ */ jsx(SelectProvider, {
|
|
18
|
-
scope: __scopeSelect,
|
|
19
|
-
...context,
|
|
20
|
-
children: /* @__PURE__ */ jsx(AdaptParentContext.Provider, {
|
|
21
|
-
value: adaptContext,
|
|
22
|
-
children
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
SelectViewport.displayName = VIEWPORT_NAME;
|
|
29
|
-
export {
|
|
30
|
-
SelectViewport
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=SelectViewport.native.js.map
|